2*2 matrix manipulation
PhilipRBrenan@yahoo.com, 2004, Perl License
Example t/matrix2.t
#_ Matrix _____________________________________________________________ # Test 2*2 matrices # philiprbrenan@yahoo.com, 2004, Perl License #______________________________________________________________________ use Math::Zap::Matrix2 identity=>i; use Math::Zap::Vector2; use Test::Simple tests=>8; my ($a, $b, $c, $v); $a = matrix2 (8, 0, 0, 8, ); $b = matrix2 (4, 2, 2, 4, ); $c = matrix2 (2, 2, 1, 2, ); $v = vector2(1,2); ok($a/$a == i()); ok($b/$b == i()); ok($c/$c == i()); ok(2/$a*$a/2 == i()); ok(($a+$b)/($a+$b) == i()); ok(($a-$c)/($a-$c) == i()); ok(-$a/-$a == i()); ok(1/$a*($a*$v) == $v);
Create a matrix
Create a matrix. Synonym for "new".
Identity matrix
Create a matrix from two vectors
Check its a matrix
Test its a matrix
Get/Set accuracy
Round: round to nearest integer if within accuracy of that integer
Singular matrix?
Create a matrix from another matrix
Print matrix
Add matrices
Negate matrix
Subtract matrices
Vector = Matrix * Vector
Matrix = Matrix * scalar
Matrix = Matrix * Matrix
Matrix=Matrix / non zero scalar
Determinant of matrix.
Inverse of matrix
Rotation matrix: rotate anti-clockwise by t radians
Equals to within accuracy
Operator overloads
Add operator.
Subtract operator.
Multiply operator.
Divide operator.
Equals operator.
Determinant of a matrix
Print a vector.
Export "matrix2", "identity"
philiprbrenan@yahoo.com
philiprbrenan@yahoo.com, 2004
Perl License.
To install Math::Zap::Draw, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Zap::Draw
CPAN shell
perl -MCPAN -e shell install Math::Zap::Draw
For more information on module installation, please visit the detailed CPAN module installation guide.