Difference between revisions of "ApCoCoA-1:LinBox.Solve"

From ApCoCoAWiki
(Description update due to extended LinBox support)
m (replaced <quotes> tag by real quotes)
 
(27 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
{{Version|1}}
 
<command>
 
<command>
<title>Solve</title>
+
  <title>LinBox.Solve</title>
<short_description>solve linear equation system</short_description>
+
  <short_description>Solves a system of linear equations.</short_description>
 +
 
 
<syntax>
 
<syntax>
 
LinBox.Solve(M:MAT, B:MAT):MAT
 
LinBox.Solve(M:MAT, B:MAT):MAT
 
LinBox.Solve(M:MAT, B:MAT, METHOD:STRING):MAT
 
LinBox.Solve(M:MAT, B:MAT, METHOD:STRING):MAT
 
</syntax>
 
</syntax>
<description>
+
  <description>
Let <tt>M</tt> and <tt>B</tt> be matrices defined over the ring of integers, a finite field or the field of rationals. This function tries to solve the linear equation system <tt>M*X = B</tt> by using the ApCoCoAServer supported by the LinBox library. If your base ring is the ring of integers or a finite field, you can pass <tt>Wiedemann</tt> as <tt>METHOD</tt> to let the ApCoCoAServer compute the solution by using the LinBox Wiedemann implementation. If you pass <tt>BlasElim</tt> instead in this case, the solution will be computed by using the LinBox BLAS elimination implementation. If you omit the parameter <tt>METHOD</tt>, <tt>Wiedemann</tt> will be used as default value where applicable. Please note that the parameter <tt>METHOD</tt> will be ignored if your base ring is the field of rationals, i.e. in this case it is always the LinBox rational solver implementation that will be used for computing a solution.
+
<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/>
 +
Let <tt>M</tt> and <tt>B</tt> be matrices defined over the ring of integers, a finite field or the field of rationals. This function tries to solve the linear equation system <tt>M*X = B</tt> by using the ApCoCoAServer supported by the LinBox library. If your base ring is the ring of integers or a finite field, you can pass <tt>Wiedemann</tt> as <tt>METHOD</tt> to let the ApCoCoAServer compute the solution by using the LinBox Wiedemann implementation. If you pass <tt>BlasElim</tt> instead in this case, the solution will be computed by using the LinBox BLAS elimination implementation. If you omit the parameter <tt>METHOD</tt>, <tt>BlasElim</tt> will be used as default value where applicable.  
 +
<par/>
 +
<em>Please note:</em> The parameter <tt>METHOD</tt> will be ignored if your base ring is the field of rationals, i.e. in this case it is always the LinBox rational solver implementation that will be used for computing a solution.
 +
<par/>
 +
The return value will be a solution vector of the linear equation system or an empty matrix if no solution has been found.
 +
<itemize>
 +
  <item>@param <em>M</em> A matrix with components either of type <tt>INT</tt>, <tt>ZMOD</tt> or <tt>RAT</tt>.</item>
 +
  <item>@param <em>B</em> A matrix with components either of type <tt>INT</tt>, <tt>ZMOD</tt> or <tt>RAT</tt>.</item>
 +
  <item>@return A matrix <tt>X</tt> representing a solution vector of the linear equation system <tt>M*X = B</tt> if a solution exists or the empty matrix otherwise.</item>
 +
</itemize>
 +
The following parameter is optional.
 +
<itemize>
 +
  <item>@param <em>METHOD</em> A string specifying the solution method to use. Available methods are "Wiedemann" and "BlasElim". Please read the detailed description about this parameter, too.</item>
 +
</itemize>
 
<example>
 
<example>
Use Z/(19)[x];
+
Use ZZ/(19)[x];
 
M := BringIn(Mat([[1,3,4], [0,2,1]]));
 
M := BringIn(Mat([[1,3,4], [0,2,1]]));
 
B := BringIn(Mat([[1], [2]]));
 
B := BringIn(Mat([[1], [2]]));
 
LinBox.Solve(M, B);
 
LinBox.Solve(M, B);
-- CoCoAServer: computing Cpu Time = 0
 
 
-------------------------------
 
-------------------------------
 
Mat([
 
Mat([
Line 22: Line 37:
 
])
 
])
 
-------------------------------
 
-------------------------------
Use Q[x];
+
</example>
 +
<example>
 +
Use QQ[x];
 
M := Mat([ [1,3,4], [0,2,1], [1,3,4] ]);
 
M := Mat([ [1,3,4], [0,2,1], [1,3,4] ]);
 
B := Mat([ [1], [2], [0] ]);
 
B := Mat([ [1], [2], [0] ]);
 
LinBox.Solve(M, B);
 
LinBox.Solve(M, B);
-- CoCoAServer: computing Cpu Time = 0
 
 
-------------------------------
 
-------------------------------
 
Mat([
 
Mat([
Line 33: Line 49:
 
-------------------------------
 
-------------------------------
 
</example>
 
</example>
</description>
+
  </description>
<see>LinKer</see>
+
 
<types>
+
  <see>ApCoCoA-1:Introduction to CoCoAServer|Introduction to CoCoAServer</see>
  <type>cocoaserver</type>
+
  <see>ApCoCoA-1:IML.Solve|IML.Solve</see>
</types>
+
  <see>ApCoCoA-1:LinAlg.Solve|LinAlg.Solve</see>
<key>solve</key>
+
  <see>ApCoCoA-1:LinKer|LinKer</see>
<key>solve linear equation system</key>
+
  <types>
<key>solve linear equation</key>
+
    <type>matrix</type>
<key>kaspar</key>
+
    <type>apcocoaserver</type>
<wiki-category>Package_LinBox</wiki-category>
+
  </types>
 +
  <key>Solve</key>
 +
  <key>LinBox.Solve</key>
 +
  <key>linbox.Solve</key>
 +
  <key>solve linear equation system</key>
 +
  <key>solve linear equation</key>
 +
  <wiki-category>ApCoCoA-1:Package_linbox</wiki-category>
 
</command>
 
</command>

Latest revision as of 13:33, 29 October 2020

This article is about a function from ApCoCoA-1.

LinBox.Solve

Solves a system of linear equations.

Syntax

LinBox.Solve(M:MAT, B:MAT):MAT
LinBox.Solve(M:MAT, B:MAT, METHOD:STRING):MAT

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.

Let M and B be matrices defined over the ring of integers, a finite field or the field of rationals. This function tries to solve the linear equation system M*X = B by using the ApCoCoAServer supported by the LinBox library. If your base ring is the ring of integers or a finite field, you can pass Wiedemann as METHOD to let the ApCoCoAServer compute the solution by using the LinBox Wiedemann implementation. If you pass BlasElim instead in this case, the solution will be computed by using the LinBox BLAS elimination implementation. If you omit the parameter METHOD, BlasElim will be used as default value where applicable.

Please note: The parameter METHOD will be ignored if your base ring is the field of rationals, i.e. in this case it is always the LinBox rational solver implementation that will be used for computing a solution.

The return value will be a solution vector of the linear equation system or an empty matrix if no solution has been found.

  • @param M A matrix with components either of type INT, ZMOD or RAT.

  • @param B A matrix with components either of type INT, ZMOD or RAT.

  • @return A matrix X representing a solution vector of the linear equation system M*X = B if a solution exists or the empty matrix otherwise.

The following parameter is optional.

  • @param METHOD A string specifying the solution method to use. Available methods are "Wiedemann" and "BlasElim". Please read the detailed description about this parameter, too.

Example

Use ZZ/(19)[x];
M := BringIn(Mat([[1,3,4], [0,2,1]]));
B := BringIn(Mat([[1], [2]]));
LinBox.Solve(M, B);
-------------------------------
Mat([
  [-2 % 19],
  [1 % 19],
  [0 % 19]
])
-------------------------------

Example

Use QQ[x];
M := Mat([ [1,3,4], [0,2,1], [1,3,4] ]);
B := Mat([ [1], [2], [0] ]);
LinBox.Solve(M, B);
-------------------------------
Mat([
  [ ]
])
-------------------------------

Introduction to CoCoAServer

IML.Solve

LinAlg.Solve

LinKer