net.sourceforge.jiu.color.data

Class MemoryCoOccurrenceFrequencyMatrix

Implemented Interfaces:
CoOccurrenceFrequencyMatrix

public class MemoryCoOccurrenceFrequencyMatrix
extends BaseCoOccurrenceFrequencyMatrix

Implements the CoOccurrenceFrequencyMatrix interface by using a large array of values in memory.
Author:
Marco Schmidt

Field Summary

private double[]
data
co occurrence frequency values
private int
dimension
will be initialized in constructor and never changed
private int
numValues
total number of values, equals dimension * dimension and data.length

Fields inherited from class net.sourceforge.jiu.color.data.BaseCoOccurrenceFrequencyMatrix

cofMean, cofStddev, scofMean, scofStddev, scofSum

Constructor Summary

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

void
clear()
Sets all values of this matrix to zero.
int
getDimension()
Returns the dimension of this matrix.
double
getValue(int i)
Returns the value of this matrix at row i, column i.
double
getValue(int i, int j)
Returns the value of this matrix at row j, column i.
void
setValue(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

computeCoOccurrenceFrequencyMeanValues, computeCoOccurrenceFrequencyStandardDeviationValues, computeSelfCoOccurrenceFrequencyMeanValue, computeSelfCoOccurrenceFrequencyStandardDeviationValue, computeStatistics, getMean, getScofMean, getScofStddev, getScofSum, getStddev

Field Details

data

private double[] data
co occurrence frequency values

dimension

private final int dimension
will be initialized in constructor and never changed

numValues

private int numValues
total number of values, equals dimension * dimension and data.length

Constructor Details

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.

Method Details

clear

public void clear()
Sets all values of this matrix to zero.
Specified by:
clear in interface CoOccurrenceFrequencyMatrix

getDimension

public int getDimension()
Returns the dimension of this matrix.
Specified by:
getDimension in interface CoOccurrenceFrequencyMatrix

getValue

public double getValue(int i)
            throws IllegalArgumentException
Returns 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).
Specified by:
getValue in interface CoOccurrenceFrequencyMatrix

getValue

public double getValue(int i,
                       int j)
            throws IllegalArgumentException
Returns 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.
Specified by:
getValue in interface CoOccurrenceFrequencyMatrix

setValue

public void setValue(int i,
                     int j,
                     double newValue)
            throws IllegalArgumentException
Sets 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.
Specified by:
setValue in interface CoOccurrenceFrequencyMatrix