maltcms.datastructures.array
Class SparseArray
java.lang.Object
maltcms.datastructures.array.SparseArray
- All Implemented Interfaces:
- Serializable, IArrayD2Double
public final class SparseArray
- extends Object
- implements IArrayD2Double
- Author:
- Nils.Hoffmann@CeBiTec.Uni-Bielefeld.DE
- See Also:
- Serialized Form
SparseArray
public SparseArray(int rows,
int columns)
columns
public int columns()
- Specified by:
columns in interface IArrayD2Double
- Returns:
- the number of columns
flatten
public cross.datastructures.tuple.Tuple2D<ArrayInt.D1,ArrayDouble.D1> flatten()
- Description copied from interface:
IArrayD2Double
- Return array in row compressed storage format.
- Specified by:
flatten in interface IArrayD2Double
- Returns:
- first array int tuple defines offsets of rows in second array
get
public double get(int row,
int col)
- Specified by:
get in interface IArrayD2Double
- Returns:
- element if row and col are in valid range, otherwise returns
default value
getArray
public ArrayDouble.D2 getArray()
- Description copied from interface:
IArrayD2Double
- Use with caution, creates the dense array according to its bounds in
memory.
- Specified by:
getArray in interface IArrayD2Double
- Returns:
- a dense representation of this array
getColumnBounds
public int[] getColumnBounds(int row)
- Specified by:
getColumnBounds in interface IArrayD2Double
- Returns:
- [lowest column in range, length of column]
getDefaultValue
public double getDefaultValue()
- Specified by:
getDefaultValue in interface IArrayD2Double
- Returns:
- the default value, e.g. 0, used for initialization
getNumberOfStoredElements
public int getNumberOfStoredElements()
- Specified by:
getNumberOfStoredElements in interface IArrayD2Double
- Returns:
- the number of elements stored in this array
getShape
public Area getShape()
- Specified by:
getShape in interface IArrayD2Double
- Returns:
- the Area enclosed by this Array
inRange
public boolean inRange(int i,
int j)
- Specified by:
inRange in interface IArrayD2Double
rows
public int rows()
- Specified by:
rows in interface IArrayD2Double
- Returns:
- the number of rows
set
public void set(int row,
int col,
double d)
throws ArrayIndexOutOfBoundsException
- Specified by:
set in interface IArrayD2Double
d - the value to be set at row,col
- Throws:
ArrayIndexOutOfBoundsException
Copyright © 2007-2012. All Rights Reserved.