org.nuiton.math.matrix
Class MatrixProxy

java.lang.Object
  extended by org.nuiton.math.matrix.AbstractMatrixND
      extended by org.nuiton.math.matrix.MatrixProxy
All Implemented Interfaces:
Serializable, Cloneable, MatrixND

public class MatrixProxy
extends AbstractMatrixND

Matrix proxy contains only dimension and semantics definition, but does not allocate memory spaces for value. Call to getSubMatrix method will return a really allocated memory matrix and use a MatrixProvider to fill matrix value. This is usefull for huge matrix that need to not be filled at first use, but after some dimensions reductions.

Version:
$Revision: 366 $ Last update : $Date: 2011-05-25 10:51:21 +0200 (mer., 25 mai 2011) $ By : $Author: echatellier $
Author:
chatellier
See Also:
MatrixProvider, Serialized Form

Field Summary
protected  MatrixProvider matrixProvider
           
 
Fields inherited from class org.nuiton.math.matrix.AbstractMatrixND
CSV_SEPARATOR, defaultValue, dim, dimHelper, dimNames, factory, name, NUMBER, semantics
 
Constructor Summary
protected MatrixProxy(MatrixFactory factory, int[] dim)
           
protected MatrixProxy(MatrixFactory factory, List<?>[] semantics)
           
protected MatrixProxy(MatrixFactory factory, String name, int[] dim)
           
protected MatrixProxy(MatrixFactory factory, String name, int[] dim, String[] dimNames)
           
protected MatrixProxy(MatrixFactory factory, String name, List<?>[] semantics)
           
protected MatrixProxy(MatrixFactory factory, String name, List<?>[] semantics, String[] dimNames)
           
 
Method Summary
 boolean equals(MatrixND mat)
           
 MatrixProvider getMatrixProvider()
           
 MatrixND getSubMatrix(int[]... elems)
          Permet de prendre une sous matrice dans la matrice courante.
 MatrixND getSubMatrix(int dim, int[] elem)
          Permet de prendre une sous matrice dans la matrice courante.
 MatrixND getSubMatrix(int dim, int start, int nb)
          Permet de prendre une sous matrice dans la matrice courante.
 MatrixND getSubMatrix(int dim, Object... elem)
          Permet de prendre une sous matrice dans la matrice courante.
 MatrixND getSubMatrix(Object[]... elems)
          Permet de prendre une sous matrice dans la matrice courante.
 double getValue(int[] coordinates)
          Renvoie un element de la matrice demandée en fonction des dimensions passé en paramètre.
 MatrixIterator iterator()
          Retourne un iterator sur toute la matrice.
 void setMatrixProvider(MatrixProvider matrixProvider)
           
 void setValue(int[] coordinates, double d)
          Modifie un element de la matrice en fonction des dimensions passé en paramètre.
 
Methods inherited from class org.nuiton.math.matrix.AbstractMatrixND
add, adds, clone, copy, cut, divs, equals, equalsValues, exportCSV, exportCSV2D, exportCSVND, fromList, getDim, getDim, getDimCount, getDimensionName, getDimensionName, getDimensionNames, getFactory, getMaxOccurence, getMaxOccurrence, getName, getNbDim, getSemantic, getSemantics, getSemantics, getSubMatrix, getSubMatrixOnSemantic, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, importCSV, importCSV, importCSV, importCSVND, importCSVNDReadDimension, init, isSupportedCSV, isValidCoordinates, isValidCoordinates, map, meanAll, meanOverDim, meanOverDim, minus, minuss, mult, mults, paste, paste, pasteSemantics, reduce, reduce, reduce, reduceDims, setDimensionName, setDimensionName, setDimensionNames, setName, setSemantic, setSemantics, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, sumAll, sumOverDim, sumOverDim, sumOverDim, toList, toString, transpose
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

matrixProvider

protected MatrixProvider matrixProvider
Constructor Detail

MatrixProxy

protected MatrixProxy(MatrixFactory factory,
                      int[] dim)

MatrixProxy

protected MatrixProxy(MatrixFactory factory,
                      List<?>[] semantics)

MatrixProxy

protected MatrixProxy(MatrixFactory factory,
                      String name,
                      int[] dim)

MatrixProxy

protected MatrixProxy(MatrixFactory factory,
                      String name,
                      int[] dim,
                      String[] dimNames)

MatrixProxy

protected MatrixProxy(MatrixFactory factory,
                      String name,
                      List<?>[] semantics)

MatrixProxy

protected MatrixProxy(MatrixFactory factory,
                      String name,
                      List<?>[] semantics,
                      String[] dimNames)
Method Detail

getMatrixProvider

public MatrixProvider getMatrixProvider()

setMatrixProvider

public void setMatrixProvider(MatrixProvider matrixProvider)

iterator

public MatrixIterator iterator()
Description copied from interface: MatrixND
Retourne un iterator sur toute la matrice.

Returns:
matrix iterator

getValue

public double getValue(int[] coordinates)
Description copied from interface: MatrixND
Renvoie un element de la matrice demandée en fonction des dimensions passé en paramètre.
Exemple: Si on a un matrice 3D.
getValue(1,1,1) retourne un element de la matrice.

Parameters:
coordinates - les différentes dimension à extraire. Le tableau doit contenir toutes les dimensions de la matrice, et seulement des nombres positif
Returns:
un entier double.

setValue

public void setValue(int[] coordinates,
                     double d)
Description copied from interface: MatrixND
Modifie un element de la matrice en fonction des dimensions passé en paramètre.
Exemple: Si on a un matrice 3D.
set([1,1,1], m) modifie un element de la matrice.

Parameters:
coordinates - dimension indices
d - new double value to set into matrix at specified dimensions

getSubMatrix

public MatrixND getSubMatrix(int dim,
                             int start,
                             int nb)
Description copied from interface: MatrixND
Permet de prendre une sous matrice dans la matrice courante. La sous matrice a le même nombre de dimensions mais sur une des dimensions on ne prend que certain élément.

Specified by:
getSubMatrix in interface MatrixND
Overrides:
getSubMatrix in class AbstractMatrixND
Parameters:
dim - la dimension dans lequel on veut une sous matrice
start - la position dans dim d'ou il faut partir pour prendre la sous matrice. 0 <= start < dim.size si start est négatif alors la position de départ est calculé par rapport à la fin de la dimension, pour avoir le dernier élément il faut passer -1
nb - le nombre d'élément à prendre dans la dimension si nb est inférieur ou égal à 0 alors cela indique qu'il faut prendre tous les éléments jusqu'à la fin de la dimension.
Returns:
new matrix

getSubMatrix

public MatrixND getSubMatrix(int dim,
                             Object... elem)
Description copied from interface: MatrixND
Permet de prendre une sous matrice dans la matrice courante. La sous matrice a le même nombre de dimensions mais sur une des dimensions on ne prend que certain élément.

Specified by:
getSubMatrix in interface MatrixND
Overrides:
getSubMatrix in class AbstractMatrixND
Parameters:
dim - la dimension dans lequel on veut une sous matrice
elem - les éléments dans la dimension à conserver
Returns:
new matrix

getSubMatrix

public MatrixND getSubMatrix(Object[]... elems)
Description copied from interface: MatrixND
Permet de prendre une sous matrice dans la matrice courante. Réalise plusieurs appels à MatrixND.getSubMatrix(int, Object...) suivant l'implémentation.

Specified by:
getSubMatrix in interface MatrixND
Overrides:
getSubMatrix in class AbstractMatrixND
Parameters:
elems - les éléments dans la dimension à conserver
Returns:
new matrix

getSubMatrix

public MatrixND getSubMatrix(int dim,
                             int[] elem)
Description copied from interface: MatrixND
Permet de prendre une sous matrice dans la matrice courante. La sous matrice a le même nombre de dimensions mais sur une des dimensions on ne prend que certain élément.

Specified by:
getSubMatrix in interface MatrixND
Overrides:
getSubMatrix in class AbstractMatrixND
Parameters:
dim - la dimension dans lequel on veut une sous matrice
elem - les indices des éléments dans la dimension à conserver
Returns:
new matrix

getSubMatrix

public MatrixND getSubMatrix(int[]... elems)
Description copied from interface: MatrixND
Permet de prendre une sous matrice dans la matrice courante. Réalise plusieurs appels a MatrixND.getSubMatrix(int, int[]) suivant l'implementation.

Specified by:
getSubMatrix in interface MatrixND
Overrides:
getSubMatrix in class AbstractMatrixND
Parameters:
elems - les indices des éléments pour chaque dimension à conserver
Returns:
new matrix

equals

public boolean equals(MatrixND mat)
Overrides:
equals in class AbstractMatrixND


Copyright © 2004-2011 CodeLutin. All Rights Reserved.