cc.mallet.types
Class DenseVector

java.lang.Object
  extended by cc.mallet.types.DenseMatrix
      extended by cc.mallet.types.DenseVector
All Implemented Interfaces:
ConstantMatrix, Matrix, Vector, java.io.Serializable

public class DenseVector
extends DenseMatrix
implements Vector, java.io.Serializable

See Also:
Serialized Form

Field Summary
 
Fields inherited from class cc.mallet.types.DenseMatrix
hasInfinite
 
Constructor Summary
DenseVector(double[] values)
           
DenseVector(double[] values, boolean copy)
           
DenseVector(int size)
           
 
Method Summary
 void addTo(double[] v)
           
 void addTo(double[] v, double factor)
           
 void arrayCopyFrom(double[] a)
          Copy values from an array into this vector.
 int arrayCopyFrom(double[] a, int startingArrayIndex)
          Copy values from an array starting at a particular index into this vector.
 int arrayCopyFrom(int i, Matrix m)
           
 int arrayCopyInto(double[] array, int startingArrayIndex)
          Copy the contents of this vector into an array starting at a particular index.
 int arrayCopyTo(int i, double[] a)
           
 int arrayCopyTo(int i, Matrix m)
           
 ConstantMatrix cloneMatrix()
           
 void columnPlusEquals(int columnIndex, double value)
           
 int getDimensions(int[] sizes)
           
 int getNumDimensions()
           
static double max(double[] v)
           
static double normalize(double[] v)
           
static void print(double[] v)
           
static void print(int[] v)
           
 void setValue(int[] indices, double value)
           
 void setValue(int index, double value)
           
 int singleIndex(int[] indices)
           
 void singleToIndices(int i, int[] indices)
           
static double sum(double[] v)
           
 double value(int index)
           
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cc.mallet.types.ConstantMatrix
absNorm, dotProduct, indexAtLocation, infinityNorm, isNaN, location, numLocations, oneNorm, print, singleSize, singleValue, twoNorm, valueAtLocation
 

Constructor Detail

DenseVector

public DenseVector(double[] values,
                   boolean copy)

DenseVector

public DenseVector(double[] values)

DenseVector

public DenseVector(int size)
Method Detail

getNumDimensions

public int getNumDimensions()
Specified by:
getNumDimensions in interface ConstantMatrix
Specified by:
getNumDimensions in class DenseMatrix

getDimensions

public int getDimensions(int[] sizes)
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

value

public double value(int index)
Specified by:
value in interface Vector

setValue

public void setValue(int[] indices,
                     double value)
Specified by:
setValue in interface Matrix
Specified by:
setValue in class DenseMatrix

setValue

public void setValue(int index,
                     double value)

columnPlusEquals

public void columnPlusEquals(int columnIndex,
                             double value)

cloneMatrix

public ConstantMatrix cloneMatrix()
Specified by:
cloneMatrix in interface ConstantMatrix
Specified by:
cloneMatrix in class DenseMatrix

singleIndex

public int singleIndex(int[] indices)
Specified by:
singleIndex in interface ConstantMatrix
Specified by:
singleIndex in class DenseMatrix

singleToIndices

public void singleToIndices(int i,
                            int[] indices)
Specified by:
singleToIndices in interface ConstantMatrix
Specified by:
singleToIndices in class DenseMatrix

arrayCopyFrom

public final int arrayCopyFrom(int i,
                               Matrix m)

arrayCopyFrom

public final void arrayCopyFrom(double[] a)
Copy values from an array into this vector. The array should have the same size as the vector


arrayCopyFrom

public final int arrayCopyFrom(double[] a,
                               int startingArrayIndex)
Copy values from an array starting at a particular index into this vector. The array must have at least as many values beyond the starting index as there are in the vector.

Returns:
Next uncopied index in the array.

arrayCopyTo

public final int arrayCopyTo(int i,
                             Matrix m)

arrayCopyTo

public final int arrayCopyTo(int i,
                             double[] a)

arrayCopyInto

public final int arrayCopyInto(double[] array,
                               int startingArrayIndex)
Copy the contents of this vector into an array starting at a particular index.

Returns:
Next available index in the array

addTo

public void addTo(double[] v)

addTo

public void addTo(double[] v,
                  double factor)

sum

public static double sum(double[] v)

normalize

public static double normalize(double[] v)

max

public static double max(double[] v)

print

public static void print(double[] v)

print

public static void print(int[] v)