Difference between revisions of "ApCoCoA-1:LinAlg.EF"

From ApCoCoAWiki
(New page: <command> <title>LinAlg.REF</title> <short_description>Computes a row echelon form of a matrix.</short_description> <syntax> LinAlg.REF(M:MAT, CompRREF:BOOL, BACKEND:STRING):MAT Lin...)
 
m (insert version info)
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{Version|1}}
 
<command>
 
<command>
   <title>LinAlg.REF</title>
+
   <title>LinAlg.EF</title>
   <short_description>Computes a row echelon form of a matrix.</short_description>
+
   <short_description>Computes a row echelon form of a matrix over <tt>F_2</tt> with record keeping.</short_description>
 
    
 
    
 
<syntax>
 
<syntax>
LinAlg.REF(M:MAT, CompRREF:BOOL, BACKEND:STRING):MAT
+
LinAlg.EF(M:LIST, L1:LIST, L2:LIST):LIST
LinAlg.REF(M:MAT, P:INT, CompRREF:BOOL, BACKEND:STRING):MAT
 
 
</syntax>
 
</syntax>
 
   <description>
 
   <description>
 
<em>Please note:</em> The function(s) explained on this page is/are using the <em>ApCoCoAServer</em>. You will have to start the ApCoCoAServer in order to use it/them.
 
<em>Please note:</em> The function(s) explained on this page is/are using the <em>ApCoCoAServer</em>. You will have to start the ApCoCoAServer in order to use it/them.
 
<par/>
 
<par/>
This function allows you to compute a (reduced) row echelon form of a matrix <tt>M</tt> defined over a (finite) field. If you want to use the first version without the parameter <tt>P</tt>, the components of the input matrix <tt>M</tt> must be castable to type <tt>RAT</tt> (<tt>BACKEND</tt> = <quotes>INTERNAL</quotes>) or <tt>ZMOD</tt> (<tt>BACKEND</tt> = <quotes>IML</quotes> or <tt>BACKEND</tt> = <quotes>LINBOX</quotes>) and your current working ring must be a finite field in the latter case. The second version of this function lets you compute a (reduced) row echelon form of <tt>M</tt> mod <tt>P</tt> and the components of <tt>M</tt> must be of type <tt>INT</tt>.
+
This function computes a row echelon form of a matrix <tt>M</tt> defined over the field <tt>F_2</tt>. It allows to keep record of the order of rows inside the matrix using the parameter <tt>L1</tt>. If the matrix contains some rows which are already in echelon form then the parameter <tt>L2</tt> represent them with 0 and all others with 1.  
 
<par/>
 
<par/>
The parameter <tt>CompRREF</tt> lets you specify if you want to compute a row echelon form or the reduced row echelon form of <tt>M</tt>. If <tt>CompRREF</tt> is set to <tt>TRUE</tt>, the reduced row echelon form will be computed, and if it is set to <tt>FALSE</tt>, a row echelon form where all pivot elements are equal to one will be computed.
+
 
<par/>
+
 
The optional parameter <tt>BACKEND</tt> lets you choose between an internal implementation (<tt>BACKEND</tt> = <quotes>INTERNAL</quotes>) or IML or LinBox driven computations (<tt>BACKEND</tt> = <quotes>IML</quotes> or <tt>BACKEND</tt> = <quotes>LINBOX</quotes>). The default value of <tt>BACKEND</tt> is <quotes>INTERNAL</quotes>.
 
 
<itemize>
 
<itemize>
   <item>@param <em>M</em> A matrix whose (reduced) row echelon form to compute. If parameter <tt>P</tt> is given, the components of <tt>M</tt> must be of type <tt>INT</tt>. Otherwise, they must be castable to type <tt>RAT</tt> or <tt>ZMOD</tt> (please see description above).</item>
+
   <item>@param <em>M:</em> A List of Lists whose row echelon form to compute.</item>
   <item>@param <em>CompRREF</em> Set to <tt>TRUE</tt> if you want to compute the reduced row echelon form of <tt>M</tt> or to <tt>FALSE</tt> otherwise.</item>
+
   <item>@param <em>L1:</em> List of integers. For example, the integers could represent the order of lists in the list M. </item>
  <item>@return A (reduced) row echelon form of <tt>M</tt>.</item>
+
   <item>@param <em>L2:</em> List of integers. For example, the integers could be 0<tt>-</tt>1 to represent the lists already reduced(0) and to be reduced(1).</item>
</itemize>
+
   <item>@return A row echelon form of <tt>M</tt> together with adjusted lists L1 and L2.</item>
The following parameters are optional.
 
<itemize>
 
   <item>@param <em>P</em> An integer value. If <tt>P</tt> is specified, the (reduced) row echelon form computation will be carried out over the ring <tt>Z/pZ</tt>.</item>
 
   <item>@param <em>BACKEND</em> Allowed values are <quotes>IML</quotes>, <quotes>INTERNAL</quotes>, and <quotes>LINBOX</quotes>.</item>
 
 
</itemize>
 
</itemize>
 +
 +
 
<example>
 
<example>
Use QQ[x,y];
+
Use ZZ/(2)[x,y];
M := Mat([[ 1/2, 1/3, 2], [200, 3000, 1], [2, 5, 17], [1, 1, 1]]);
+
M := [
LinAlg.REF(M, FALSE);
+
      [1, 1, 0, 1, 0],
 +
      [0, 1, 1, 0, 1],
 +
      [1, 0, 1, 0, 0],  
 +
      [1, 1, 1, 0, 1]
 +
    ];
 +
-- order of lists in M
 +
L1:=[1, 2, 3, 4];
 +
 
 +
-- 0 for lists which are already in echelon form and 1 for those to be reduced.
 +
L2:=[0, 0, 1, 1];
 +
 
 +
LinAlg.EF(M, L1, L2);
  
 +
-- CoCoAServer: computing Cpu Time = 0
 
-------------------------------
 
-------------------------------
Mat([
+
[ [[1, 1, 0, 1, 0], [0, 1, 1, 0, 1], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1]], [1, 2, 4, 3], [0, 0, 1, 1]]
  [1, 2/3, 4],
+
 
  [0, 1, -2397/8600],
+
-- The last two lists represent the new order of lists in M.
  [0, 0, 1],
 
  [0, 0, 0]
 
])
 
-------------------------------
 
 
</example>
 
</example>
 +
 
<example>
 
<example>
Use QQ[x,y];
+
Use ZZ/(2)[x,y];
M := Mat([[ 1, 1, 2], [200, 3000, 1], [2, 5, 17], [1, 1, 1]]);
+
M := [
LinAlg.REF(M, 17, TRUE);
+
      [0, 1, 0, 1, 0],
 +
      [0, 1, 0, 0, 1],
 +
      [1, 0, 1, 1, 0],  
 +
      [1, 1, 0, 0, 1]
 +
    ];
 +
-- order of lists in M
 +
L1:=[1, 2, 3, 4];  
 +
 
 +
-- 0 for lists which are already in echelon form and 1 for those to be reduced.
 +
L2:=[0, 0, 1, 1];
  
 +
LinAlg.EF(M, L1, L2);
 +
 +
-- CoCoAServer: computing Cpu Time = 0.015
 
-------------------------------
 
-------------------------------
Mat([
+
[[[1, 0, 1, 1, 0], [0, 1, 0, 1, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 1]], [3, 1, 4, 2], [1, 0, 1, 0]]
  [1, 0, 0],
 
  [0, 1, 0],
 
  [0, 0, 1],
 
  [0, 0, 0]
 
])
 
 
-------------------------------
 
-------------------------------
 +
 +
-- The last two lists represent the new order of lists in M.
 +
 
</example>
 
</example>
<example>
 
Use QQ[x,y];
 
M := Mat([[ 1, 1, 2], [200, 3000, 1], [2, 5, 17], [1, 1, 1]]);
 
LinAlg.REF(M, 17, TRUE, "IML");
 
  
-------------------------------
 
Mat([
 
  [1, 0, 0],
 
  [0, 1, 0],
 
  [0, 0, 1],
 
  [0, 0, 0]
 
])
 
-------------------------------
 
</example>
 
<example>
 
Use ZZ/(239)[x];
 
M := Mat([[1, 2, 3], [4, 5, 6], [7, 8, 9], [11, 12, 13]]);
 
LinAlg.REF(M, FALSE, "LINBOX");
 
  
-------------------------------
+
 
Mat([
 
  [1 % 239, 2 % 239, 3 % 239],
 
  [0 % 239, 1 % 239, 2 % 239],
 
  [0 % 239, 0 % 239, 0 % 239],
 
  [0 % 239, 0 % 239, 0 % 239]
 
])
 
</example>
 
 
   </description>
 
   </description>
   <see>Introduction to CoCoAServer</see>
+
   <see>ApCoCoA-1:Introduction to CoCoAServer|Introduction to CoCoAServer</see>
   <see>IML.REF</see>
+
   <see>ApCoCoA-1:IML.REF|IML.REF</see>
   <see>LinBox.REF</see>
+
   <see>ApCoCoA-1:LinBox.REF|LinBox.REF</see>
 
   <types>
 
   <types>
 
     <type>apcocoaserver</type>
 
     <type>apcocoaserver</type>
 
     <type>matrix</type>>
 
     <type>matrix</type>>
 
   </types>
 
   </types>
   <key>REF</key>
+
   <key>EF</key>
   <key>LinAlg.REF</key>
+
   <key>LinAlg.EF</key>
 
   <key>row echelon form</key>
 
   <key>row echelon form</key>
   <wiki-category>Package_linalg</wiki-category>
+
   <wiki-category>ApCoCoA-1:Package_linalg</wiki-category>
 
</command>
 
</command>

Latest revision as of 10:10, 7 October 2020

This article is about a function from ApCoCoA-1.

LinAlg.EF

Computes a row echelon form of a matrix over F_2 with record keeping.

Syntax

LinAlg.EF(M:LIST, L1:LIST, L2:LIST):LIST

Description

Please note: The function(s) explained on this page is/are using the ApCoCoAServer. You will have to start the ApCoCoAServer in order to use it/them.

This function computes a row echelon form of a matrix M defined over the field F_2. It allows to keep record of the order of rows inside the matrix using the parameter L1. If the matrix contains some rows which are already in echelon form then the parameter L2 represent them with 0 and all others with 1.


  • @param M: A List of Lists whose row echelon form to compute.

  • @param L1: List of integers. For example, the integers could represent the order of lists in the list M.

  • @param L2: List of integers. For example, the integers could be 0-1 to represent the lists already reduced(0) and to be reduced(1).

  • @return A row echelon form of M together with adjusted lists L1 and L2.


Example

Use ZZ/(2)[x,y];
M := [
      [1, 1, 0, 1, 0],
      [0, 1, 1, 0, 1],
      [1, 0, 1, 0, 0], 
      [1, 1, 1, 0, 1]
     ];
-- order of lists in M
L1:=[1, 2, 3, 4]; 

-- 0 for lists which are already in echelon form and 1 for those to be reduced.
L2:=[0, 0, 1, 1];

LinAlg.EF(M, L1, L2);

-- CoCoAServer: computing Cpu Time = 0
-------------------------------
[ [[1, 1, 0, 1, 0], [0, 1, 1, 0, 1], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1]], [1, 2, 4, 3], [0, 0, 1, 1]]

-- The last two lists represent the new order of lists in M.

Example

Use ZZ/(2)[x,y];
M := [
      [0, 1, 0, 1, 0],
      [0, 1, 0, 0, 1],
      [1, 0, 1, 1, 0], 
      [1, 1, 0, 0, 1]
     ];
-- order of lists in M
L1:=[1, 2, 3, 4]; 

-- 0 for lists which are already in echelon form and 1 for those to be reduced.
L2:=[0, 0, 1, 1];

LinAlg.EF(M, L1, L2);

-- CoCoAServer: computing Cpu Time = 0.015
-------------------------------
[[[1, 0, 1, 1, 0], [0, 1, 0, 1, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 1]], [3, 1, 4, 2], [1, 0, 1, 0]]
-------------------------------

-- The last two lists represent the new order of lists in M.



Introduction to CoCoAServer

IML.REF

LinBox.REF