From ApCoCoAWiki
Revision as of 12:48, 24 April 2009 by Stadler (talk | contribs)


Solve a linear equation system.


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


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 that 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.

  • @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.

  • @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.


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


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

Introduction to CoCoAServer