Math::Matrix

Math::Matrix can multiply and invert Matrices.
Download

Math::Matrix Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Ulrich Pfeifer
  • Publisher web site:
  • http://search.cpan.org/~ulpfr/

Math::Matrix Tags


Math::Matrix Description

Math::Matrix can multiply and invert Matrices. Math::Matrix can multiply and invert Matrices.The following methods are available:newConstructor arguments are a list of references to arrays of the same length. The arrays are copied. The method returns undef in case of error. $a = new Math::Matrix (, , );If you call new as method, a zero filled matrix with identical deminsions is returned.cloneYou can clone a matrix by calling: $b = $a->clone;sizeYou can determine the dimensions of a matrix by calling: ($m, $n) = $a->size;concatConcatenates two matrices of same row count. The result is a new matrix or undef in case of error. $b = new Math::Matrix (,,); $c = $a->concat($b);transposeReturns the transposed matrix. This is the matrix where colums and rows of the argument matrix are swaped.multiplyMultiplies two matrices where the length of the rows in the first matrix is the same as the length of the columns in the second matrix. Returns the product or undef in case of error.solveSolves a equation system given by the matrix. The number of colums must be greater than the number of rows. If variables are dependent from each other, the second and all further of the dependent coefficients are 0. This means the method can handle such systems. The method returns a matrix containing the solutions in its columns or undef in case of error.invertInvert a Matrix using solve.multiply_scalarMultiplies a matrix and a scalar resulting in a matrix of the same dimensions with each element scaled with the scalar. $a->multiply_scalar(2); scale matrix by factor 2addAdd two matrices of the same dimensions.substractShorthand for add($other->negative)equalDecide if two matrices are equal. The criterion is, that each pair of elements differs less than $Math::Matrix::eps.sliceExtract columns: a->slice(1,3,5);determinantCompute the determinant of a matrix.dot_productCompute the dot product of two vectors.absoluteCompute the absolute value of a vector.normalizingNormalize a vector.cross_productCompute the cross-product of vectors.printPrints the matrix on STDOUT. If the method has additional parameters, these are printed before the matrix is printed.pinvertCompute the pseudo-inverse of the matrix: ((A'A)^-1)A'EXAMPLE use Math::Matrix; srand(time); $a = new Math::Matrix (, , ); $x = new Math::Matrix (); $a->print("An"); $E = $a->concat($x->transpose); $E->print("Equation systemn"); $s = $E->solve; $s->print("Solutions sn"); $a->multiply($s)->print("A*sn"); Requirements: · Perl


Math::Matrix Related Software