Class DefaultSparseGenericMatrix<A>

All Implemented Interfaces:
Serializable, Cloneable, Comparable<Matrix>, HasMetaData, BaseMatrix, BooleanCalculations, CanPerformCalculations, DenseMatrix, DenseMatrix2D, DenseMatrixMultiD, BasicDoubleCalculations, DoubleCalculations, BasicEntrywiseDoubleCalculations, CreatorDoubleCalculations, EntrywiseDoubleCalculations, HyperbolicDoubleCalculations, MiscEntrywiseDoubleCalculations, RoundingDoubleCalculations, TrigonometricDoubleCalculations, DecompositionDoubleCalculations, DiscretizeCalculations, GeneralDoubleCalculations, MiscGeneralDoubleCalculations, MissingValueDoubleCalculations, StatisticalDoubleCalculations, BaseGenericMatrix<A>, DenseGenericMatrix<A>, DenseGenericMatrix2D<A>, DenseGenericMatrixMultiD<A>, GenericMatrix<A>, GenericMatrix2D<A>, GenericMatrixMultiD<A>, SparseGenericMatrix<A>, SparseGenericMatrix2D<A>, SparseGenericMatrixMultiD<A>, BaseMatrixProperties, Clearable, Conversions, CoordinateFunctions, CoreObject, DistanceMeasures, ExtendedMatrixProperties, GettersAndSetters, HasDescription, HasGUIObject, HasId, HasLabel, IntCalculations, Matrix, Matrix2D, MatrixMultiD, ObjectCalculations, SparseMatrix, SparseMatrix2D, SparseMatrixMultiD, StringCalculations
Direct Known Subclasses:
DefaultSparseBigDecimalMatrix, DefaultSparseBigIntegerMatrix, DefaultSparseBooleanMatrix, DefaultSparseByteMatrix, DefaultSparseCharMatrix, DefaultSparseDoubleMatrix, DefaultSparseFloatMatrix, DefaultSparseIntMatrix, DefaultSparseLongMatrix, DefaultSparseObjectMatrix, DefaultSparseShortMatrix, DefaultSparseStringMatrix

public class DefaultSparseGenericMatrix<A> extends AbstractSparseGenericMatrix<A>
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • values

      protected final Map<Coordinates,A> values
    • maximumNumberOfEntries

      private int maximumNumberOfEntries
  • Constructor Details

    • DefaultSparseGenericMatrix

      public DefaultSparseGenericMatrix(Matrix m)
    • DefaultSparseGenericMatrix

      public DefaultSparseGenericMatrix(Matrix m, int maximumNumberOfEntries)
    • DefaultSparseGenericMatrix

      public DefaultSparseGenericMatrix(long... size)
  • Method Details

    • setSize

      public void setSize(long... size)
      Description copied from interface: BaseMatrixProperties
      Sets the size of the matrix. This is an optional method that is not implemented for all matrices. If this method is not implemented, a MatrixException is thrown.
      Specified by:
      setSize in interface BaseMatrixProperties
      Overrides:
      setSize in class AbstractMatrix
      Parameters:
      size - the new size of the matrix
    • getObject

      public A getObject(long... coordinates)
    • getValueCount

      public long getValueCount()
      Specified by:
      getValueCount in interface BaseMatrixProperties
      Overrides:
      getValueCount in class AbstractMatrix
    • setObject

      public void setObject(Object value, long... coordinates)
      Specified by:
      setObject in interface GenericMatrixMultiD<A>
      Overrides:
      setObject in class AbstractGenericMatrix<A>
    • availableCoordinates

      public Iterable<long[]> availableCoordinates()
      Description copied from interface: CoordinateFunctions
      Returns an Iterator that only goes over the coordinates in the Matrix that are stored. For most Matrices, this is the same as allCoordinates(). For sparse Matrices, it iterates only over the entries in it.
      Returns:
      Iterable over the saved entries in a Matrix.
    • containsCoordinates

      public boolean containsCoordinates(long... coordinates)
      Description copied from interface: CoordinateFunctions
      Determines if the given Coordinates are part of the Matrix. If the Matrix is dense, true is returned for all Coordinates smaller than the Matrix's size. For sparse Matrices, this function checks if the coordinates are actually stored in the matrix or not.
      Parameters:
      coordinates - The coordinates to check
      Returns:
      a boolean stating if the coordinates are part of the Matrix
    • getAsDouble

      public double getAsDouble(long... coordinates)
      Description copied from interface: GettersAndSetters
      Returns a double representation of an entry in the matrix. The stored value will be converted to a double as good as possible.
      Specified by:
      getAsDouble in interface GettersAndSetters
      Overrides:
      getAsDouble in class AbstractMatrix
      Parameters:
      coordinates - location of the entry
      Returns:
      a double representation of the entry @
    • setAsDouble

      public void setAsDouble(double value, long... coordinates)
      Description copied from interface: GettersAndSetters
      Sets an entry in the matrix to a double value. If the matrix cannot store double values, the value will be represented as good as possible.
      Specified by:
      setAsDouble in interface GettersAndSetters
      Overrides:
      setAsDouble in class AbstractMatrix
      Parameters:
      value - double value
      coordinates - location of the entry @
    • getValueType

      public ValueType getValueType()
      Specified by:
      getValueType in interface BaseMatrixProperties
      Overrides:
      getValueType in class AbstractMatrix
    • clear

      public final void clear()