Package cc.mallet.types
Class DenseVector
- java.lang.Object
-
- cc.mallet.types.DenseMatrix
-
- 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
Constructors Constructor Description DenseVector(double[] values)
DenseVector(double[] values, boolean copy)
DenseVector(int size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
-
-
-
Method Detail
-
getNumDimensions
public int getNumDimensions()
- Specified by:
getNumDimensions
in interfaceConstantMatrix
- Specified by:
getNumDimensions
in classDenseMatrix
-
getDimensions
public int getDimensions(int[] sizes)
- Specified by:
getDimensions
in interfaceConstantMatrix
- Specified by:
getDimensions
in classDenseMatrix
-
value
public double value(int[] indices)
- Specified by:
value
in interfaceConstantMatrix
- Specified by:
value
in classDenseMatrix
-
setValue
public void setValue(int[] indices, double value)
- Specified by:
setValue
in interfaceMatrix
- Specified by:
setValue
in classDenseMatrix
-
setValue
public void setValue(int index, double value)
-
columnPlusEquals
public void columnPlusEquals(int columnIndex, double value)
-
cloneMatrix
public ConstantMatrix cloneMatrix()
- Specified by:
cloneMatrix
in interfaceConstantMatrix
- Specified by:
cloneMatrix
in classDenseMatrix
-
singleIndex
public int singleIndex(int[] indices)
- Specified by:
singleIndex
in interfaceConstantMatrix
- Specified by:
singleIndex
in classDenseMatrix
-
singleToIndices
public void singleToIndices(int i, int[] indices)
- Specified by:
singleToIndices
in interfaceConstantMatrix
- Specified by:
singleToIndices
in classDenseMatrix
-
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)
-
-