Class SparseMatrixn

  • All Implemented Interfaces:
    ConstantMatrix, Matrix, java.io.Serializable, java.lang.Cloneable

    public class SparseMatrixn
    extends java.lang.Object
    implements Matrix, java.lang.Cloneable, java.io.Serializable
    Implementation of Matrix that allows arbitrary number of dimensions. This implementation simply uses a flat array. Created: Tue Sep 16 14:52:37 2003
    Version:
    $Id: SparseMatrixn.java,v 1.1 2007/10/22 21:37:39 mccallum Exp $
    Author:
    Charles Sutton
    See Also:
    Serialized Form
    • Constructor Detail

      • SparseMatrixn

        public SparseMatrixn​(double[] vals)
        Create a 1-d dense matrix with the given values.
      • SparseMatrixn

        public SparseMatrixn​(int[] szs)
        Create a dense matrix with the given dimensions.
        Parameters:
        szs - An array containing the maximum for each dimension.
      • SparseMatrixn

        public SparseMatrixn​(int[] szs,
                             double[] vals)
      • SparseMatrixn

        public SparseMatrixn​(int[] szs,
                             int[] idxs,
                             double[] vals)
        Create a sparse matrix with the given dimensions and the given values.
        Parameters:
        szs - An array containing the maximum for each dimension.
        idxs - An array containing the single index for each entry of the matrix. A single index is an integer computed from the indices of each dimension. as returned by Matrixn.singleIndex(int[]).
        vals - A flat array of the entries of the matrix, in row-major order.