Package org.nuiton.math.matrix
Class MatrixProxy
- java.lang.Object
-
- org.nuiton.math.matrix.AbstractMatrixND
-
- 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 aMatrixProviderto 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$ Last update : $Date$ By : $Author$
- Author:
- chatellier
- See Also:
MatrixProvider, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected MatrixProvidermatrixProvider-
Fields inherited from class org.nuiton.math.matrix.AbstractMatrixND
CSV_SEPARATOR, defaultValue, dim, dimHelper, dimNames, factory, name, NUMBER, NUMBER_REGEX, semantics
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMatrixProxy(MatrixFactory factory, int[] dim)protectedMatrixProxy(MatrixFactory factory, String name, int[] dim)protectedMatrixProxy(MatrixFactory factory, String name, int[] dim, String[] dimNames)protectedMatrixProxy(MatrixFactory factory, String name, List<?>[] semantics)protectedMatrixProxy(MatrixFactory factory, String name, List<?>[] semantics, String[] dimNames)protectedMatrixProxy(MatrixFactory factory, List<?>[] semantics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(MatrixND mat)MatrixProvidergetMatrixProvider()longgetNumberOfAssignedValue()Returne number of assigned value, assigned value is value stored in memoryMatrixNDgetSubMatrix(int[]... elems)Permet de prendre une sous matrice dans la matrice courante.MatrixNDgetSubMatrix(int dim, int[] elem)Permet de prendre une sous matrice dans la matrice courante.MatrixNDgetSubMatrix(int dim, int start, int nb)Permet de prendre une sous matrice dans la matrice courante.MatrixNDgetSubMatrix(int dim, Object... elem)Permet de prendre une sous matrice dans la matrice courante.MatrixNDgetSubMatrix(Object[]... elems)Permet de prendre une sous matrice dans la matrice courante.doublegetValue(int[] coordinates)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.MatrixIteratoriterator()Retourne un iterator sur toute la matrice.MatrixIteratoriteratorNotZero()Retourne un iterator pour toutes les valeurs de la matrices differente de 0voidsetMatrixProvider(MatrixProvider matrixProvider)voidsetValue(int[] coordinates, double d)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.-
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, 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, size, sumAll, sumOverDim, sumOverDim, sumOverDim, toList, toString, transpose
-
-
-
-
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
-
getNumberOfAssignedValue
public long getNumberOfAssignedValue()
Description copied from interface:MatrixNDReturne number of assigned value, assigned value is value stored in memory
-
getMatrixProvider
public MatrixProvider getMatrixProvider()
-
setMatrixProvider
public void setMatrixProvider(MatrixProvider matrixProvider)
-
iterator
public MatrixIterator iterator()
Description copied from interface:MatrixNDRetourne un iterator sur toute la matrice.- Returns:
- matrix iterator
-
iteratorNotZero
public MatrixIterator iteratorNotZero()
Description copied from interface:MatrixNDRetourne un iterator pour toutes les valeurs de la matrices differente de 0- Returns:
- matrix iterator
-
getValue
public double getValue(int[] coordinates)
Description copied from interface:MatrixNDRenvoie 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:MatrixNDModifie 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 indicesd- new double value to set into matrix at specified dimensions
-
getSubMatrix
public MatrixND getSubMatrix(int dim, int start, int nb)
Description copied from interface:MatrixNDPermet 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:
getSubMatrixin interfaceMatrixND- Overrides:
getSubMatrixin classAbstractMatrixND- Parameters:
dim- la dimension dans lequel on veut une sous matricestart- 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 -1nb- 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:
- un objet SubMatrix qui est une vu de la matrice initiale (toute modification de la sous-matrice, modifie la matrice initiale)
-
getSubMatrix
public MatrixND getSubMatrix(int dim, Object... elem)
Description copied from interface:MatrixNDPermet 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:
getSubMatrixin interfaceMatrixND- Overrides:
getSubMatrixin classAbstractMatrixND- Parameters:
dim- la dimension dans lequel on veut une sous matriceelem- les éléments dans la dimension à conserver- Returns:
- un objet SubMatrix qui est une vu de la matrice initiale (toute modification de la sous-matrice, modifie la matrice initiale)
-
getSubMatrix
public MatrixND getSubMatrix(Object[]... elems)
Description copied from interface:MatrixNDPermet de prendre une sous matrice dans la matrice courante. Réalise plusieurs appels àMatrixND.getSubMatrix(int, Object...)suivant l'implémentation.- Specified by:
getSubMatrixin interfaceMatrixND- Overrides:
getSubMatrixin classAbstractMatrixND- Parameters:
elems- les éléments dans la dimension à conserver- Returns:
- un objet SubMatrix qui est une vu de la matrice initiale (toute modification de la sous-matrice, modifie la matrice initiale)
-
getSubMatrix
public MatrixND getSubMatrix(int dim, int[] elem)
Description copied from interface:MatrixNDPermet 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:
getSubMatrixin interfaceMatrixND- Overrides:
getSubMatrixin classAbstractMatrixND- Parameters:
dim- la dimension dans lequel on veut une sous matriceelem- les indices des éléments dans la dimension à conserver- Returns:
- un objet SubMatrix qui est une vu de la matrice initiale (toute modification de la sous-matrice, modifie la matrice initiale)
-
getSubMatrix
public MatrixND getSubMatrix(int[]... elems)
Description copied from interface:MatrixNDPermet de prendre une sous matrice dans la matrice courante. Réalise plusieurs appels aMatrixND.getSubMatrix(int, int[])suivant l'implementation.- Specified by:
getSubMatrixin interfaceMatrixND- Overrides:
getSubMatrixin classAbstractMatrixND- Parameters:
elems- les indices des éléments pour chaque dimension à conserver- Returns:
- un objet SubMatrix qui est une vu de la matrice initiale (toute modification de la sous-matrice, modifie la matrice initiale)
-
equals
public boolean equals(MatrixND mat)
- Overrides:
equalsin classAbstractMatrixND
-
-