Package net.sourceforge.jiu.color.data
Class MemoryCoOccurrenceFrequencyMatrix
- java.lang.Object
-
- net.sourceforge.jiu.color.data.BaseCoOccurrenceFrequencyMatrix
-
- net.sourceforge.jiu.color.data.MemoryCoOccurrenceFrequencyMatrix
-
- All Implemented Interfaces:
CoOccurrenceFrequencyMatrix
public class MemoryCoOccurrenceFrequencyMatrix extends BaseCoOccurrenceFrequencyMatrix
Implements theCoOccurrenceFrequencyMatrixinterface by using a large array of values in memory.- Author:
- Marco Schmidt
-
-
Constructor Summary
Constructors Constructor Description MemoryCoOccurrenceFrequencyMatrix(int dimension)Creates a co-occurrence frequency matrix of given dimension; allocates dimension times dimension double values for internal array; does not call clear() to set everything to zero, must be done by user (or automatically in init).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Sets all values of this matrix to zero.intgetDimension()Returns the dimension of this matrix.doublegetValue(int i)Returns the value of this matrix at row i, column i.doublegetValue(int i, int j)Returns the value of this matrix at row j, column i.voidsetValue(int i, int j, double newValue)Sets value at row j, column i to newValue.-
Methods inherited from class net.sourceforge.jiu.color.data.BaseCoOccurrenceFrequencyMatrix
computeStatistics, getMean, getScofMean, getScofStddev, getScofSum, getStddev
-
-
-
-
Constructor Detail
-
MemoryCoOccurrenceFrequencyMatrix
public MemoryCoOccurrenceFrequencyMatrix(int dimension)
Creates a co-occurrence frequency matrix of given dimension; allocates dimension times dimension double values for internal array; does not call clear() to set everything to zero, must be done by user (or automatically in init). Dimension should be number of colors in palette.- Throws:
IllegalArgumentException- if dimension is smaller than 1
-
-
Method Detail
-
clear
public void clear()
Sets all values of this matrix to zero.
-
getDimension
public int getDimension()
Description copied from interface:CoOccurrenceFrequencyMatrixReturns the dimension of this matrix.
-
getValue
public double getValue(int i) throws IllegalArgumentExceptionReturns the value of this matrix at row i, column i. Argument is zero-based, so make sure that 0 <= i < getDimension(). Other values will raise an IllegalArgumentException. Simply calls getValue(i, i).- Parameters:
i- index into the matrix, must be larger than or equal to 0 and smaller thanCoOccurrenceFrequencyMatrix.getDimension()- Throws:
IllegalArgumentException
-
getValue
public double getValue(int i, int j) throws IllegalArgumentExceptionReturns the value of this matrix at row j, column i. Both arguments are zero-based, so make sure that 0 <= i, j < getDimension(). Other values will raise an IllegalArgumentException.- Throws:
IllegalArgumentException
-
setValue
public void setValue(int i, int j, double newValue) throws IllegalArgumentExceptionSets value at row j, column i to newValue. Both arguments are zero-based, so make sure that 0 <= i, j < getDimension(). Other values will raise an IllegalArgumentException.- Throws:
IllegalArgumentException
-
-