JAMA

# Class: MagicSquareExample

Source Location: /PHPExcel/Shared/JAMA/examples/MagicSquareExample.php

### Class Overview

Example of use of Matrix Class, featuring magic squares.

### Methods

- magic
- main
- microtime_float

### Class Details

[line 11]
Example of use of Matrix Class, featuring magic squares.
[ Top ]

### Class Methods

### method magic [line 17]

`void magic( int $n)`

Generate magic square test matrix.

#### Parameters:

int | $n | n dimension of matrix

[ Top ]

### method main [line 100]

`void main( )`

Tests LU, QR, SVD and symmetric Eig decompositions.

n = order of magic square. trace = diagonal sum, should be the magic sum, (n^3 + n)/2. max_eig = maximum eigenvalue of (A + A')/2, should equal trace. rank = linear algebraic rank, should equal n if n is odd, be less than n if n is even. cond = L_2 condition number, ratio of singular values. lu_res = test of LU factorization, norm1(L*U-A(p,:))/(n*eps). qr_res = test of QR factorization, norm1(Q*R-A)/(n*eps).

[ Top ]

### method microtime_float [line 83]

`void microtime_float( )`

Simple function to replicate PHP 5 behaviour
[ Top ]

Documentation generated on Fri, 12 Oct 2012 00:16:40 +0200 by phpDocumentor 1.4.4