# Matrix2

2*2 matrix manipulation

## Synopsis

Example t/matrix2.t

`````` #_ Matrix _____________________________________________________________
# Test 2*2 matrices
#______________________________________________________________________

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);
``````

## Description

2*2 matrix manipulation

## Constructors

Create a matrix

### matrix2

Create a matrix. Synonym for "new".

Identity matrix

### new2v

Create a matrix from two vectors

## Methods

### check

Check its a matrix

### is

Test its a matrix

Get/Set accuracy

### round

Round: round to nearest integer if within accuracy of that integer

Singular matrix?

### clone

Create a matrix from another matrix

Print matrix

Negate matrix

### subtract

Subtract matrices

### matrixVectorMultiply

Vector = Matrix * Vector

### matrixScalarMultiply

Matrix = Matrix * scalar

### matrixMatrixMultiply

Matrix = Matrix * Matrix

### matrixScalarDivide

Matrix=Matrix / non zero scalar

### det

Determinant of matrix.

### inverse

Inverse of matrix

### rotate

Rotation matrix: rotate anti-clockwise by t radians

### equals

Equals to within accuracy

## Operators

### subtract operator

Subtract operator.

### multiply operator

Multiply operator.

Divide operator.

Equals operator.

### determinant operator

Determinant of a matrix

Print a vector.

## Exports

Export "matrix2", "identity"

## Credits

### Author

philiprbrenan@yahoo.com

philiprbrenan@yahoo.com, 2004