[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/library/ezc/Graph/src/math/ -> matrix.php (summary)

File containing the abstract ezcGraphMatrix class

Copyright: Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
License: http://ez.no/licenses/new_bsd New BSD License
Version: 1.5
File Size: 511 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ezcGraphMatrix:: (15 methods):
  __construct()
  fromArray()
  init()
  rows()
  columns()
  get()
  set()
  add()
  diff()
  scalar()
  transpose()
  multiply()
  solveNonlinearEquatation()
  LRdecomposition()
  __toString()


Class: ezcGraphMatrix  - X-Ref

Provides a genereic matrix class with basic math operations

The matrix class is used for internal matrix calculations, and it should not
be required to be used by end users. It offers the common arithmetics
operations, and a __toString mechanism for debugging.

Beside this it implements more complex matrix algorithms to solve non linear
equatations using the Gauss-Newton algorithm and LR decomposition using the
Cholesky-Crout algorithm. These algorithms are required by the average
polynom calculation in the ezcGraphDataSetAveragePolynom class.

__construct( $rows = 3, $columns = 3, array $values = null )   X-Ref
Constructor

Creates a matrix with given dimensions. Optionally accepts an array to
define the initial matrix values. If no array is given an identity
matrix is created.

param: int $rows Number of rows
param: int $columns Number of columns
param: array $values Array with values
return: void

fromArray( array $values )   X-Ref
Create matrix from array

Use an array with float values to set matrix values.

param: array $values Array with values
return: ezcGraphMatrix Modified matrix

init()   X-Ref
Init matrix

Sets matrix to identity matrix.

return: ezcGraphMatrix Modified matrix

rows()   X-Ref
Returns number of rows

return: int Number of rows

columns()   X-Ref
Returns number of columns

return: int Number of columns

get( $i, $j )   X-Ref
Get a single matrix value

Returns the value of the matrix at the given position

param: int $i Column
param: int $j Row
return: float Matrix value

set( $i, $j, $value )   X-Ref
Set a single matrix value

Sets the value of the matrix at the given position.

param: int $i Column
param: int $j Row
param: float $value Value
return: ezcGraphMatrix Updated matrix

add( ezcGraphMatrix $matrix )   X-Ref
Adds one matrix to the current one

Calculate the sum of two matrices and returns the resulting matrix.

param: ezcGraphMatrix $matrix Matrix to sum with
return: ezcGraphMatrix Result matrix

diff( ezcGraphMatrix $matrix )   X-Ref
Subtracts matrix from current one

Calculate the diffenrence of two matices and returns the result matrix.

param: ezcGraphMatrix $matrix subtrahend
return: ezcGraphMatrix Result matrix

scalar( $scalar )   X-Ref
Scalar multiplication

Multiplies matrix with the given scalar and returns the result matrix

param: float $scalar Scalar
return: ezcGraphMatrix Result matrix

transpose()   X-Ref
Transpose matrix

return: ezcGraphMatrix Transposed matrix

multiply( ezcGraphMatrix $matrix )   X-Ref
Multiplies two matrices

Multiply current matrix with another matrix and returns the result
matrix.

param: ezcGraphMatrix $matrix Second factor
return: ezcGraphMatrix Result matrix

solveNonlinearEquatation( ezcGraphMatrix $matrix )   X-Ref
Solve nonlinear equatation

Tries to solve equatation given by two matrices, with assumption, that:
A * x = B
where $this is A, and the paramenter B. x is cosnidered as a vector
x = ( x^n, x^(n-1), ..., x^2, x, 1 )

Will return a polynomial solution for x.

See: http://en.wikipedia.org/wiki/Gauss-Newton_algorithm

param: ezcGraphMatrix $matrix B
return: ezcGraphPolygon Solution of equatation

LRdecomposition()   X-Ref
Build LR decomposition from matrix

Use Cholesky-Crout algorithm to get LR decomposition of the current
matrix.

Will return an array with two matrices:
array(
'l' => (ezcGraphMatrix) $left,
'r' => (ezcGraphMatrix) $right,
)

return: array( ezcGraphMatrix )

__toString()   X-Ref
Returns a string representation of the matrix

return: string



Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7