  
  [1X6 [33X[0;0YLinear Algebra routines[133X[101X
  
  
  [1X6.1 [33X[0;0YSemi echelonised bases and cleaning[133X[101X
  
  [33X[0;0YA  semi echelonised basis is a record with the following components: [10Xvectors[110X
  is a list of vectors of equal length, optionally (and optimally) they can be
  wrapped  to a matrix. [10Xpivots[110X is a list of integers. The number [22Xi[122X in position
  [22Xj[122X  indicates that the [22Xj[122Xth vector in [10Xvectors[110X has a one in column number [22Xi[122X and
  all  vectors  with  a  number bigger than [22Xj[122X in [10Xvectors[110X have a zero in column
  number [22Xi[122X.[133X
  
  [33X[0;0YNote that for technical reasons another component [10Xhelper[110X is bound containing
  a [10Xcvec[110X of length [22X1[122X over the same field.[133X
  
  [33X[0;0YNote  further  that  the  output of the [5XGAP[105X library operation [2XSemiEchelonMat[102X
  ([14XReference:  SemiEchelonMat[114X)  is  not  compatible  to this setup, because it
  contains  a  component  [10Xheads[110X  that  contains at position [22Xi[122X, if nonzero, the
  number of the row for that the pivot element is in column [22Xi[122X.[133X
  
  [1X6.1-1 EmptySemiEchelonBasis[101X
  
  [29X[2XEmptySemiEchelonBasis[102X( [3Xv[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya new mutable empty semi echelonised basis[133X
  
  [33X[0;0YThe argument [3Xv[103X must be a sample vector.[133X
  
  [1X6.1-2 MakeSemiEchelonBasis[101X
  
  [29X[2XMakeSemiEchelonBasis[102X( [3Xb[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya semi echelonised basis[133X
  
  [33X[0;0YTurns  the  output  [3Xb[103X  of  [2XSemiEchelonMat[102X ([14XReference: SemiEchelonMat[114X) into a
  valid  semi  echelonised  basis in the sense of the [5Xcvec[105X package. This means
  that  the  component [10Xpivots[110X is calculated from the component [10Xheads[110X. Use this
  function only if necessary. Directly use [2XSemiEchelonRows[102X ([14X6.1-6[114X) instead.[133X
  
  [1X6.1-3 Vectors[101X
  
  [29X[2XVectors[102X( [3Xb[103X ) [32X operation
  [6XReturns:[106X  [33X[0;10Ya matrix[133X
  
  [33X[0;0YThe  argument  [3Xb[103X  must be a semi echelonised basis. This operation returns a
  (mutable) matrix whose rows are the basis vectors.[133X
  
  [1X6.1-4 Length[101X
  
  [29X[2XLength[102X( [3Xb[103X ) [32X operation
  [6XReturns:[106X  [33X[0;10Yan integer[133X
  
  [33X[0;0YThe  argument [3Xb[103X must be a semi echelonised basis. This operation returns the
  number of vectors in the basis.[133X
  
  [1X6.1-5 CleanRow[101X
  
  [29X[2XCleanRow[102X( [3Xb[103X, [3Xv[103X, [3Xextend[103X, [3Xdec[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X
  
  [33X[0;0YThis  is  the  basic operation for cleaning with a semi echelonised basis [3Xb[103X.
  The  vector [3Xv[103X is cleaned with the vectors in the semi echelonised basis. The
  function returns [10Xtrue[110X if [3Xv[103X lies in the span of [3Xb[103X and false otherwise.[133X
  
  [33X[0;0YThe  boolean value [3Xextend[103X indicates, whether the basis should be extended in
  the latter case by the newly cleaned vector.[133X
  
  [33X[0;0YThe  argument  [3Xdec[103X  is  either [10Xfail[110X in which case it is not used or a vector
  over the same field as [3Xv[103X that is at least as long as the number [22Xn[122X of vectors
  in  [3Xb[103X  (plus one if [3Xextend[103X is [10Xtrue[110X). In this case, the first [22Xn[122X components of
  [3Xdec[103X  are  changed  such that [22X∑_{i=1}^n [3Xdec[103X_i [3Xb[103X_i[122X. If [3Xextend[103X is [10Xtrue[110X and [3Xv[103X is
  not  contained in the span of the vectors in [3Xb[103X and [3Xdec[103X is a vector, then the
  first [22Xn+1[122X components of [3Xdec[103X are changed such that [22X[3Xv[103X = ∑_{i=1}^n+1 [3Xdec[103X_i [3Xb[103X_i[122X.[133X
  
  [1X6.1-6 SemiEchelonRows[101X
  
  [29X[2XSemiEchelonRows[102X( [3Xm[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya semi echelonised basis[133X
  
  [33X[0;0YThe  argument  [3Xm[103X  must  be a [10Xcmat[110X. This method calculates a semi echelonised
  basis for the row space of [3Xm[103X.[133X
  
  [33X[0;0YThere are a number of similar operations the names of which are derived from
  [2XSemiEchelonRows[102X  by  appending  single  letters:  The letters [21XP[121X, [21XT[121X and [21XX[121X are
  modifiers  and  there are operations for most of the [22X8[122X combinations of those
  letters  being  present or not respectively. Always give the present letters
  in alphabetical order.[133X
  
  [33X[0;0YThe  [21XX[121X  indicates, that the input matrix may be destroyed, that is, the rows
  of  [3Xm[103X  will  be  changed  and  the  very  same  objects  be used in the semi
  echelonised result basis.[133X
  
  [33X[0;0YThe  [21XT[121X  indicates,  that  the  transformation  is  calculated,  that is, the
  resulting  record  [10Xr[110X will have a component [10Xcoeffs[110X, such that [10Xr.coeffs * [3Xm[103X[10X[110X is
  equal  to  [10Xr.vectors[110X component of the semi echelonised result. Further, with
  given  letter [21XT[121X there will be a component [10Xrelations[110X which is a basis for the
  (left) nullspace of [3Xm[103X.[133X
  
  [33X[0;0YThe  [21XP[121X  indicates,  that  a  component  [10Xr.p[110X  is  calculated  such that [10Xr.p *
  r.vectors[110X is the original matrix [3Xm[103X.[133X
  
  [33X[0;0YCurrently  the  variants with [21XP[121X and [21XT[121X both present are not implement because
  they will probably not be very useful.[133X
  
  [1X6.1-7 SemiEchelonRowsX[101X
  
  [29X[2XSemiEchelonRowsX[102X( [3Xm[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya semi echelonised basis[133X
  
  [33X[0;0YSame as [2XSemiEchelonRows[102X ([14X6.1-6[114X) but destructive in [3Xm[103X.[133X
  
  [1X6.1-8 SemiEchelonRowsT[101X
  
  [29X[2XSemiEchelonRowsT[102X( [3Xm[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya semi echelonised basis[133X
  
  [33X[0;0YSame  as  [2XSemiEchelonRows[102X ([14X6.1-6[114X) but in addition stores the transformation,
  see [2XSemiEchelonRows[102X ([14X6.1-6[114X).[133X
  
  [1X6.1-9 SemiEchelonRowsTX[101X
  
  [29X[2XSemiEchelonRowsTX[102X( [3Xm[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya semi echelonised basis[133X
  
  [33X[0;0YSame as [2XSemiEchelonRowsT[102X ([14X6.1-8[114X) but destructive in [3Xm[103X.[133X
  
  [1X6.1-10 SemiEchelonRowsP[101X
  
  [29X[2XSemiEchelonRowsP[102X( [3Xm[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya semi echelonised basis[133X
  
  [33X[0;0YSame   as  [2XSemiEchelonRows[102X  ([14X6.1-6[114X)  but  in  addition  stores  the  inverse
  transformation, see [2XSemiEchelonRows[102X ([14X6.1-6[114X).[133X
  
  [1X6.1-11 SemiEchelonRowsPX[101X
  
  [29X[2XSemiEchelonRowsPX[102X( [3Xm[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya semi echelonised basis[133X
  
  [33X[0;0YSame as [2XSemiEchelonRowsP[102X ([14X6.1-10[114X) but destructive in [3Xm[103X.[133X
  
  [1X6.1-12 MutableNullspaceMat[101X
  
  [29X[2XMutableNullspaceMat[102X( [3Xm[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya [10Xcmat[110X[133X
  
  [33X[0;0YReturns  a [10Xcmat[110X the rows of which are a basis of the (left) nullspace of the
  [10Xcmat[110X  [3Xm[103X.  Internally,  [2XSemiEchelonRowsT[102X  ([14X6.1-8[114X)  is  used and the component
  [10Xrelations[110X  of  the  result  is returned. The result is mutable, which is the
  reason  for  the  introduction  of  a  new  operation  besides  [2XNullspaceMat[102X
  ([14XReference: NullspaceMat[114X).[133X
  
  [1X6.1-13 MutableNullspaceMatX[101X
  
  [29X[2XMutableNullspaceMatX[102X( [3Xm[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya [10Xcmat[110X[133X
  
  [33X[0;0YSame as [2XMutableNullspaceMat[102X ([14X6.1-12[114X) but destructive in [3Xm[103X.[133X
  
  [1X6.1-14 NullspaceMat[101X
  
  [29X[2XNullspaceMat[102X( [3Xm[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Yan immutable [10Xcmat[110X[133X
  
  [33X[0;0YBehaves exactly as expected. [3Xm[103X must be a [10Xcmat[110X.[133X
  
  [1X6.1-15 NullspaceMatDestructive[101X
  
  [29X[2XNullspaceMatDestructive[102X( [3Xm[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Yan immutable [10Xcmat[110X[133X
  
  [33X[0;0YBehaves exactly as expected. [3Xm[103X must be a [10Xcmat[110X.[133X
  
  
  [1X6.2 [33X[0;0YCharacteristic and minimal polynomial[133X[101X
  
  [1X6.2-1 CharacteristicPolynomialOfMatrix[101X
  
  [29X[2XCharacteristicPolynomialOfMatrix[102X( [3Xm[103X ) [32X method
  [29X[2XCharacteristicPolynomialOfMatrix[102X( [3Xm[103X, [3Xindetnr[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya record[133X
  
  [33X[0;0YCalculates  the characteristic polynomial of the [10Xcmat[110X [3Xm[103X over its base field.
  Because  during  the  calculations  the  polynomial automatically comes as a
  product  of some not necessarily irreducible factors, the result is returned
  in  a  record  with  two  components.  The  [10Xpoly[110X component contains the full
  characteristic  polynomial.  The  [10Xfactors[110X  component  contains a list of not
  necessarily  irreducibly  factors the product of which is the characteristic
  polynomial.  If  an  indeterminate  number  is given as second argument, the
  polynomials  are  written  in  that  indeterminate,  otherwise  in the first
  indeterminate over the base field.[133X
  
  [1X6.2-2 FactorsOfCharacteristicPolynomial[101X
  
  [29X[2XFactorsOfCharacteristicPolynomial[102X( [3Xm[103X ) [32X method
  [29X[2XFactorsOfCharacteristicPolynomial[102X( [3Xm[103X, [3Xindetnr[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya list[133X
  
  [33X[0;0YCalculates  the characteristic polynomial of the [10Xcmat[110X [3Xm[103X over its base field.
  The result is a list of irreducible factors of the characteristic polynomial
  of  [3Xm[103X, the product of which is the characteristic polynomial. Because during
  the calculations the polynomial automatically comes as a product of some not
  necessarily   irreducible   factors,   this  is  more  efficient  than  just
  calculating  the  characteristic  polynomial  and  then  factoring it. If an
  indeterminate  number  is  given  as  second  argument,  the polynomials are
  written in that indeterminate, otherwise in the first indeterminate over the
  base field.[133X
  
  [1X6.2-3 MinimalPolynomialOfMatrix[101X
  
  [29X[2XMinimalPolynomialOfMatrix[102X( [3Xm[103X ) [32X method
  [29X[2XMinimalPolynomialOfMatrix[102X( [3Xm[103X, [3Xindetnr[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya polynomial over the base field of [3Xm[103X[133X
  
  [33X[0;0YCalculates  the  minimal  polynomial  of the [10Xcmat[110X [3Xm[103X over its base field. The
  polynomial  is  returned.  If  an  indeterminate  number  is given as second
  argument,  the  polynomials  are written in that indeterminate, otherwise in
  the first indeterminate over the base field.[133X
  
  [1X6.2-4 CharAndMinimalPolynomialOfMatrix[101X
  
  [29X[2XCharAndMinimalPolynomialOfMatrix[102X( [3Xm[103X ) [32X method
  [29X[2XCharAndMinimalPolynomialOfMatrix[102X( [3Xm[103X, [3Xindetnr[103X ) [32X method
  [6XReturns:[106X  [33X[0;10Ya record[133X
  
  [33X[0;0YCalculates  the characteristic and minimal polynomial of the [10Xcmat[110X [3Xm[103X over its
  base  field.  Because  during  the calculation of the minimal polynomial the
  characteristic  polynomial is calculated anyway, the result is returned in a
  record  with  five  components:  The  [10Xcharpoly[110X  component  contains the full
  characteristic   polynomial.  The  [10Xirreds[110X  component  contains  the  set  of
  irreducible  factors  of  the  characteristic polynomial as a list. The [10Xmult[110X
  component  contains  a  corresponding  list  of  multiplicities,  that is in
  position  [22Xi[122X  is  the  multiplicity of the irreducible factor number [22Xi[122X in the
  characteristic  polynomial.  The  component  [10Xminpoly[110X  contains  the  minimal
  polynomial and the component [10Xmultmin[110X the corresponding multiplicities of the
  irreducible   factors  of  the  characteristic  polynomial  in  the  minimal
  polynomial.  If  an  indeterminate  number  is given as second argument, the
  polynomials  are  written  in  that  indeterminate,  otherwise  in the first
  indeterminate over the base field.[133X
  
  [1X6.2-5 MinimalPolynomialOfMatrixMC[101X
  
  [29X[2XMinimalPolynomialOfMatrixMC[102X( [3Xm[103X, [3Xprob[103X[, [3Xindetnr[103X] ) [32X operation
  [6XReturns:[106X  [33X[0;10Ya record[133X
  
  [33X[0;0YThis method calculates the characteristic and minimal polynomials of the row
  list  matrix  [3Xm[103X  over  its base domain. It uses the Monte Carlo algorithm by
  Neunhoeffer  and Praeger. The second argument [3Xprob[103X is an upper bound for the
  error probability, it can be [22X0[122X in which case a deterministic verification is
  done.  The optional argument [3Xindetnr[103X is the number of the indeterminate over
  the base domain to be used to express polynomials.[133X
  
  [33X[0;0YThe  result  is  a record with the following components bound: The component
  [10Xcharpoly[110X is the characteristic polynomial which is guaranteed to be correct.
  The  component  [10Xminpoly[110X  is  always  a divisor of the minimal polynomial and
  usually  is  equal  to  it. See below for details. The component [10Xirreds[110X is a
  sorted list of the irreducible factors of the characteristic polynomial. The
  component  [10Xmult[110X  is  a  corresponding list of the same length containing the
  multiplicities   of   these   irreducible   factors  in  the  characteristic
  polynomial. The component [10Xminmult[110X is a corresponding list of the same length
  containing the multiplicities of these irreducible factors in the polynomial
  given in [10Xminpoly[110X. The component [10Xproof[110X is set to [10Xtrue[110X if the result is proved
  to  be  correct,  which can happen even if [3Xprob[103X was non-zero (for example in
  the  case  of a cyclic matrix). The component [10Xiscyclic[110X is set to [10Xtrue[110X if and
  only  if  the  minimal polynomial is equal to the characteristic polynomial.
  The component [10Xprob[110X is set to the probability given in [3Xprob[103X, if that was zero
  then  it is set to [22X1/10000[122X but [10Xproof[110X will be [10Xtrue[110X. The components [10XA[110X, [10XB[110X and [10XS[110X
  describe  a  base  change  for  [3Xm[103X  to  a  sparse form which is obtained as a
  byproduct.  [10XS[110X  is  a  semi echelonised basis which was obtained by a spin-up
  computation with [3Xm[103X and if [22XY[122X is the sparse basis then [22XY = A ⋅ S[122X and [22XB=A^-1[122X.[133X
  
  [33X[0;0YThe given result for the minimal polynomial could be a proper divisor of the
  real  minimal  polynomial if [3Xprob[103X was non-zero, however, the probability for
  this outcome is guaranteed to be less than or equal to [3Xprob[103X. Note that it is
  always guaranteed that all irreducible factors of the minimal polynomial are
  actually present, it can only happen that the multiplicities are too small.[133X
  
