Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cc.mallet.types
Class Matrixn

    java.lang.Object
      cc.mallet.types.DenseMatrix
          cc.mallet.types.Matrixn

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

    public class Matrixn

extends DenseMatrix
implements java.lang.Cloneable

Implementation of Matrix that allows arbitrary number of dimensions. This implementation simply uses a flat array. This also provides static utilities for doing arbitrary-dimensional array indexing (see `singleIndex(int[])`, `singleToIndices(int, int[])`). Created: Tue Sep 16 14:52:37 2003

Version:
  $Id: Matrixn.java,v 1.1 2007/10/22 21:37:39 mccallum Exp $
Author:
  Charles Sutton
See Also:
  Serialized Form

Field Summary

Fields inherited from class cc.mallet.types.DenseMatrix
`hasInfinite`

Constructor Summary
`Matrixn(double[] vals)` Create a 1-d matrix with the given values.
`Matrixn(int[] szs)` Create a matrix with the given dimensions.
`Matrixn(int[] szs, double[] vals)` Create a matrix with the given dimensions and the given values.

Method Summary
`java.lang.Object` | `clone()`
`ConstantMatrix` | `cloneMatrix()`
`boolean` | `equals(java.lang.Object o)`
`int` | `getDimensions(int[] szs)`
`int` | `getNumDimensions()`
`static void` | `main(java.lang.String[] args)`
`void` | `setValue(int[] indices, double value)`
`int` | `singleIndex(int[] indices)`
`static int` | `singleIndex(int[] szs, int[] indices)`
`void` | `singleToIndices(int single, int[] indices)`
`static void` | `singleToIndices(int single, int[] indices, int[] szs)` Just a utility function for arbitrary-dimensional matrix dereferencing.
`double[]` | `toArray()` Returns a one-dimensional array representation of the matrix.
`double` | `value(int[] indices)`

Methods inherited from class cc.mallet.types.DenseMatrix
`absNorm, absNormalize, almostEquals, divideEquals, dotProduct, elementwiseDivideEquals, elementwiseDivideEquals, elementwiseTimesEquals, elementwiseTimesEquals, equalsPlus, incrementSingleValue, indexAtLocation, infinityNorm, infinityNorm, infinityNormalize, isNaN, location, numLocations, oneNorm, oneNormalize, plusEquals, plusEquals, plusEquals, plusEquals, plusEquals, print, set, setAll, setSingleValue, setValueAtLocation, setWithAddend, setWithFactor, singleSize, singleValue, substitute, timesEquals, timesEquals, twoNorm, twoNormalize, valueAtLocation`

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Matrixn

    public Matrixn(double[] vals)

  Create a 1-d matrix with the given values.

### Matrixn

    public Matrixn(int[] szs)

  Create a matrix with the given dimensions.

  Parameters:
    `szs` - An array containing the maximum for each dimension.

### Matrixn

    public Matrixn(int[] szs,
                   double[] vals)

  Create a matrix with the given dimensions and the given values.

  Parameters:
    `szs` - An array containing the maximum for each dimension.
    `vals` - A flat array of the entries of the matrix, in row-major order.

Method Detail

### getNumDimensions

    public int getNumDimensions()

  Specified by:
    `getNumDimensions` in interface `ConstantMatrix`
  Specified by:
    `getNumDimensions` in class `DenseMatrix`

### getDimensions

    public int getDimensions(int[] szs)

  Specified by:
    `getDimensions` in interface `ConstantMatrix`
  Specified by:
    `getDimensions` in class `DenseMatrix`

### value

    public double value(int[] indices)

  Specified by:
    `value` in interface `ConstantMatrix`
  Specified by:
    `value` in class `DenseMatrix`

### setValue

    public void setValue(int[] indices,
                         double value)

  Specified by:
    `setValue` in interface `Matrix`
  Specified by:
    `setValue` in class `DenseMatrix`

### cloneMatrix

    public ConstantMatrix cloneMatrix()

  Specified by:
    `cloneMatrix` in interface `ConstantMatrix`
  Specified by:
    `cloneMatrix` in class `DenseMatrix`

### clone

    public java.lang.Object clone()

  Overrides:
    `clone` in class `java.lang.Object`

### singleIndex

    public int singleIndex(int[] indices)

  Specified by:
    `singleIndex` in interface `ConstantMatrix`
  Specified by:
    `singleIndex` in class `DenseMatrix`

### singleIndex

    public static int singleIndex(int[] szs,
                                  int[] indices)

### singleToIndices

    public void singleToIndices(int single,
                                int[] indices)

  Specified by:
    `singleToIndices` in interface `ConstantMatrix`
  Specified by:
    `singleToIndices` in class `DenseMatrix`

### singleToIndices

    public static void singleToIndices(int single,
                                       int[] indices,
                                       int[] szs)

  Just a utility function for arbitrary-dimensional matrix dereferencing.

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### toArray

    public double[] toArray()

  Returns a one-dimensional array representation of the matrix. Caller must not modify the return value.

  Returns:
    An array of the values where index 0 is the major index, etc.

### main

    public static void main(java.lang.String[] args)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD