Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

# Math::MatrixReal::Aug 0.02

Date Added: April 17, 2010  |  Visits: 756

SYNOPSIS use Math::MatrixReal; use Math::MatrixReal::Aug; These are certain extra methods for Math::MatrixReal, in the tradition of Math::MatrixReal::Ext1; \$matrix1->augmentright(\$matrix2); Creates a new matrix of the form [\$matrix1 \$matrix2]. \$matrix1 and \$matrix2 must have the same number of rows. Example: \$A = Math::MatrixReal->new_from_cols([[1,0]]); \$B = Math::MatrixReal->new_from_cols([[1,2],[2,1]]); \$C = \$A / \$B print \$C; [ 1.000000000000E+00 1.000000000000E+00 2.000000000000E+00 ] [ 0.000000000000E+00 2.000000000000E+00 1.000000000000E+00 ] \$matrix1->augmentbelow(\$matrix2); Creates a new matrix of the form [ \$matrix1 ] [ \$matrix2 ]. \$matrix1 and \$matrix2 must have the same number of columns. Example: \$A = Math::MatrixReal->new_from_cols([[1,0],[0,1]]); \$B = Math::MatrixReal->new_from_cols([[1,2],[2,1]]); \$C = \$A / \$B print \$C; [ 1.000000000000E+00 0.000000000000E+00 ] [ 0.000000000000E+00 1.000000000000E+00 ] [ 1.000000000000E+00 2.000000000000E+00 ] [ 2.000000000000E+00 1.000000000000E+00 ] \$matrix->applyfunction(\$coderef) Applies &\$coderef to each element of \$matrix, and returns the result. \$coderef should be a reference to a subroutine that takes four parameters: (\$matrix, \$matrix->element(\$i,\$j), \$i, \$j) where \$i and \$j are the row and column indices of the current element. Example: sub increment { my (\$matrix,\$element, \$i,\$j)=@_; return \$element+1; } \$A = Math::MatrixReal->new_from_cols([[1,0],[0,1]]); \$E=\$A->applyfunction(&increment); print \$E; [ 2.000000000000E+00 1.000000000000E+00 ] [ 1.000000000000E+00 2.000000000000E+00 ] \$matrix->largeexponential(\$exponent) Finds \$matrix^\$exponent using the square-and-multiply method. \$matrix must be square and \$exponent must be a positive integer. Much more efficient for large \$exponent than \$matrix->\$exponential(\$exponent) in that approximately log2(\$exponent) multiplications are required instead of approximately \$exponent. \$matrix->fill(\$const); Sets all elements of \$matrix equal to \$const. Example: \$A = new Math::MatrixReal(3,3); \$A->fill(4); print \$A; [ 4.000000000000E+00 4.000000000000E+00 4.000000000000E+00 ] [ 4.000000000000E+00 4.000000000000E+00 4.000000000000E+00 ] [ 4.000000000000E+00 4.000000000000E+00 4.000000000000E+00 ] \$new_matrix = \$some_matrix->newfill(\$rows,\$columns,\$const); \$new_matrix = Math::MatrixReal->newfill(\$rows,\$columns,\$const); Creates a new matrix of the specified size, all the elements of which are \$const. Example: \$A = Math::MatrixReal->newfill(3,3,4); print \$A; [ 4.000000000000E+00 4.000000000000E+00 4.000000000000E+00 ] [ 4.000000000000E+00 4.000000000000E+00 4.000000000000E+00 ] [ 4.000000000000E+00 4.000000000000E+00 4.000000000000E+00 ].

 Requirements: No special requirements Platforms: Linux Keyword: Aug Perl,  Cols,  Const,  Exponent,  Libraries,  Mathmatrixrealaug,  Matrix,  Matrixreal,  New,  Print,  Programming Users rating: 0/10