NAME

Math::MatrixReal::Aug - Additional methods for Math::MatrixReal.

SYNOPSIS

use Math::MatrixReal;
use Math::MatrixReal::Aug;

DESCRIPTION

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 ]

OVERLOADED OPERATORS

New Binary operators:

x, .

x

Right augmenting binary operator.

$A x $B 
is the same as 
$A->augmentright($B)
.

Bottom augmenting binary operator.

$A . $B  
is the same as 
$A->augmentbelow($B)

NOTES

The augmentright operator has a higher precence than the augmentbelow operator, so $A x $B . $B x $A is [ $A $B ] [ $B $A ]

BUGS

Provably countably infinite.

This document can be improved.

No testing routines are provided.

AUTHOR

Jacob C. Kesinger, <kesinger@math.ttu.edu>

SEE ALSO

Math::MatrixReal.