spis.Util.Matrix
Class DiagMatrix

java.lang.Object
  extended byspis.Util.Matrix.Matrix
      extended byspis.Util.Matrix.DiagMatrix
All Implemented Interfaces:
java.io.Serializable

public class DiagMatrix
extends Matrix
implements java.io.Serializable

Class Name : DiagMatrix
Project ref : SPIS project
File name : DiagMatrix.java
File type : class
Copyright : ONERA, 2 Av. E. Belin, 31055 Toulouse cedex, France http://www.onecert.fr
Status : under development
Creation : 25/08/2003
Modification :

Description : Diagonal Matrix class

Versions and anomalies correction :

Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 JF Roussel, roussel@onecert.frCreation


Version:
0.1
Author:
JF Roussel
See Also:
Serialized Form

Field Summary
private  float[] diagVal
          matrix values
 
Fields inherited from class spis.Util.Matrix.Matrix
 
Constructor Summary
DiagMatrix(float[] values)
          Constructor with data
DiagMatrix(float[] values, int dim)
          Constructor with data and size (for re-dimensionning if needed).
DiagMatrix(float x, int dim)
          Constructor for matrix proportional to identity: x Id_matrix, of dimension dim.
 
Method Summary
 Matrix buildLineNormalised()
          Generates and returns a matrix built from this matrix by normalising each of its lines: Mij -> Mij / (sum_k Mik).
 Matrix buildTranspose()
          Generates and returns the transpose of this matrix
 float[] getDiagValues()
           
 float[][] getValues()
          Returns a 2D array representing the matrix (here, it is the actual array stored in the DirMatrix).
 void incrementValue(int i, int j, float incr)
          Increments the element (i,j) of the matrix of the value incr.
 Matrix matMult(Matrix m)
          Multyplies by another matrix m and returns this_matrix . m.
private  float[][] matMult(Matrix m, int notUsedInteger)
          Multiplies by another matrix m and returns this_matrix . m as a float[][].
 void matMult(Matrix m, Matrix result)
          Multyplies by another matrix m and returns this_matrix . m in result.
 void setDiagValues(float[] values)
          Defines this diagonal matrix with this float array (no copy, pointing to this array).
 void setDiagValues(float[] values, int d)
          Defines this matrix with this float array (no copy, pointing to this array).
 void setValue(int i, int j, float val)
          Sets the element (i,j) of the matrix to the value val.
 void vectMult(FloatScalTable x, FloatScalTable y)
          Multyplies by a vector (x) and returns y = matrix x.
 
Methods inherited from class spis.Util.Matrix.Matrix
doubleVectMult, getDim1, getDim2, linearSystemSolve, setDim1, setDim2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

diagVal

private float[] diagVal
matrix values

Constructor Detail

DiagMatrix

public DiagMatrix(float[] values,
                  int dim)
Constructor with data and size (for re-dimensionning if needed). Redimensionning may be further optimised.


DiagMatrix

public DiagMatrix(float[] values)
Constructor with data


DiagMatrix

public DiagMatrix(float x,
                  int dim)
Constructor for matrix proportional to identity: x Id_matrix, of dimension dim.

Method Detail

vectMult

public void vectMult(FloatScalTable x,
                     FloatScalTable y)
Multyplies by a vector (x) and returns y = matrix x.

Specified by:
vectMult in class Matrix

matMult

public void matMult(Matrix m,
                    Matrix result)
Multyplies by another matrix m and returns this_matrix . m in result.

Specified by:
matMult in class Matrix
Parameters:
m -
result - this . m, as a matrix of predefined subtype (if possible)

matMult

public Matrix matMult(Matrix m)
Multyplies by another matrix m and returns this_matrix . m.

Specified by:
matMult in class Matrix
Parameters:
m -
Returns:
this . m, as a DirMatrix

matMult

private float[][] matMult(Matrix m,
                          int notUsedInteger)
Multiplies by another matrix m and returns this_matrix . m as a float[][].

Parameters:
m -
notUsedInteger - spurious integer, only here to distinguish this method interface from Matrix matMult(Matrix)
Returns:
this_matrix multiplied by m matrix, as a float[][] array

buildTranspose

public Matrix buildTranspose()
Generates and returns the transpose of this matrix

Specified by:
buildTranspose in class Matrix

buildLineNormalised

public Matrix buildLineNormalised()
Generates and returns a matrix built from this matrix by normalising each of its lines: Mij -> Mij / (sum_k Mik). Returns a DirMatrix.

Specified by:
buildLineNormalised in class Matrix

getValues

public float[][] getValues()
Returns a 2D array representing the matrix (here, it is the actual array stored in the DirMatrix).

Specified by:
getValues in class Matrix

setDiagValues

public void setDiagValues(float[] values)
Defines this diagonal matrix with this float array (no copy, pointing to this array). The matrix dimension is defined as the one of the float array (values.length).

Parameters:
values -

setDiagValues

public void setDiagValues(float[] values,
                          int d)
Defines this matrix with this float array (no copy, pointing to this array). The matrix dimension is defined as d, hence values must be at least [d] (extra values ignored).

Parameters:
values -
d -

setValue

public void setValue(int i,
                     int j,
                     float val)
Description copied from class: Matrix
Sets the element (i,j) of the matrix to the value val. Only partially supported by derived classes: only diagonal term for a DiagMatrix, and only values already present in the matrix structure for a SparseMatrix

Specified by:
setValue in class Matrix
Parameters:
i -
j -
val -
See Also:
Matrix.setValue(int, int, float)

incrementValue

public void incrementValue(int i,
                           int j,
                           float incr)
Description copied from class: Matrix
Increments the element (i,j) of the matrix of the value incr. Only partially supported by derived classes: only diagonal term for a DiagMatrix, and only values already present in the matrix structure for a SparseMatrix

Specified by:
incrementValue in class Matrix
Parameters:
i -
j -
See Also:
Matrix.incrementValue(int, int, float)

getDiagValues

public float[] getDiagValues()
Returns:
Returns the diagonal values.