org.eclipse.birt.chart.internal.computations
Class Matrix

java.lang.Object
  extended byorg.eclipse.birt.chart.internal.computations.Matrix
All Implemented Interfaces:
java.lang.Cloneable

public class Matrix
extends java.lang.Object
implements java.lang.Cloneable

Matrix


Constructor Summary
Matrix(double[][] data, int m, int n)
           
Matrix(double[] A, int m)
           
Matrix(int m, int n)
           
 
Method Summary
 Matrix copy()
           
 double get(int i, int j)
           
 double[][] getArray()
           
 double[][] getArrayCopy()
           
 int getColumnDimension()
           
 int getRowDimension()
           
static Matrix identity(int m, int n)
           
 Matrix inverse()
           
 void set(int i, int j, double s)
           
 Matrix times(Matrix matrix)
           
 Matrix transpose()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Matrix

public Matrix(int m,
              int n)
Parameters:
m - number of rows.
n - number of colums.

Matrix

public Matrix(double[][] data,
              int m,
              int n)
Parameters:
data - an array of doubles.
m - number of rows.
n - number of colums.

Matrix

public Matrix(double[] A,
              int m)
Parameters:
A - an array of doubles packed by columns.
m - number of rows.
Throws:
java.lang.IllegalArgumentException - Array length must be a multiple of m.
Method Detail

copy

public Matrix copy()
Returns:
matrix a deep copy of matrix.

getArray

public double[][] getArray()
Returns:
data a pointer to the matrix data array.

getArrayCopy

public double[][] getArrayCopy()
Returns:
A a copy of the matrix data array.

getRowDimension

public int getRowDimension()
Returns:
m the number of rows.

getColumnDimension

public int getColumnDimension()
Returns:
n the number of columns.

get

public double get(int i,
                  int j)
Parameters:
i - row index.
j - column index.
Returns:
data(i,j) a single element within Matrix.

set

public void set(int i,
                int j,
                double s)
Parameters:
i - row index.
j - column index.
s - a single element set to the Matrix.
Throws:
java.lang.ArrayIndexOutOfBoundsException

transpose

public Matrix transpose()
Returns:
matrix transposed matrix (A')

times

public Matrix times(Matrix matrix)
Parameters:
matrix - another matrix
Returns:
mResult matrix1 * matrix2
Throws:
java.lang.IllegalArgumentException - Matrix inner dimensions must agree.

identity

public static Matrix identity(int m,
                              int n)
Parameters:
m - number of rows.
n - number of colums.
Returns:
matrix an m*n matrix with "1" on the diagonal and "0" elsewhere.

inverse

public Matrix inverse()
Returns:
inversed matrix.


Copyright © 2005-2007 Actuate Corp. All rights reserved.