public abstract class DenseVector extends Vector
Constructor and Description |
---|
DenseVector(int length) |
Modifier and Type | Method and Description |
---|---|
<T> T |
apply(VectorMatrixOperation<T> operation,
Matrix that)
Pipes this vector to a given
operation . |
<T> T |
apply(VectorOperation<T> operation)
Pipes this vector to a given
operation . |
<T> T |
apply(VectorVectorOperation<T> operation,
Vector that)
Pipes this vector to a given
operation . |
static DenseVector |
constant(int length,
double value)
|
static DenseVector |
fromArray(double[] array)
Creates a new
DenseVector from the given array w/o
copying the underlying array. |
static DenseVector |
fromCollection(Collection<? extends Number> list)
Creates new
DenseVector from |
static DenseVector |
fromCSV(String csv)
Parses
DenseVector from the given CSV string. |
static DenseVector |
fromMap(Map<Integer,? extends Number> map,
int length)
Creates new
DenseVector from index-value map |
static DenseVector |
fromMatrixMarket(String mm)
Parses
DenseVector from the given Matrix Market string. |
static DenseVector |
random(int length,
Random random)
|
abstract double[] |
toArray()
Converts this dense vector to a double array.
|
Matrix |
toColumnMatrix()
Converts this vector to matrix with only one column.
|
Matrix |
toDiagonalMatrix()
Converts this vector to a diagonal matrix.
|
String |
toMatrixMarket(NumberFormat formatter)
Converts this vector into the string in Matrix Market format
using the given
formatter ; |
Matrix |
toRowMatrix()
Converts this vector to matrix with only one row.
|
static DenseVector |
unit(int length)
Creates an unit
DenseVector of the given length . |
static DenseVector |
zero(int length)
Creates a zero
DenseVector of the given length . |
add, add, blank, blankOfLength, copy, copyOfLength, divide, each, ensureLengthIsCorrect, equals, equals, euclideanNorm, fail, fold, get, hadamardProduct, hashCode, infinityNorm, innerProduct, is, iterator, length, manhattanNorm, max, min, mkString, mkString, multiply, multiply, non, norm, outerProduct, product, select, set, setAll, shuffle, slice, sliceLeft, sliceRight, subtract, subtract, sum, swapElements, to, toBinary, toCSV, toCSV, toDenseVector, toMatrixMarket, toSparseVector, toString, transform, update, updateAt
public static DenseVector zero(int length)
DenseVector
of the given length
.public static DenseVector constant(int length, double value)
public static DenseVector unit(int length)
DenseVector
of the given length
.public static DenseVector random(int length, Random random)
public static DenseVector fromArray(double[] array)
DenseVector
from the given array
w/o
copying the underlying array.public static DenseVector fromCSV(String csv)
DenseVector
from the given CSV string.csv
- the CSV string representing a vectorpublic static DenseVector fromMatrixMarket(String mm)
DenseVector
from the given Matrix Market string.mm
- the string in Matrix Market formatpublic static DenseVector fromCollection(Collection<? extends Number> list)
DenseVector
fromlist
- list containing doublespublic static DenseVector fromMap(Map<Integer,? extends Number> map, int length)
DenseVector
from index-value mapmap
- index-value maplength
- vector lengthpublic <T> T apply(VectorOperation<T> operation)
Vector
operation
.public <T> T apply(VectorVectorOperation<T> operation, Vector that)
Vector
operation
.public <T> T apply(VectorMatrixOperation<T> operation, Matrix that)
Vector
operation
.apply
in class Vector
T
- the result typeoperation
- the vector-matrix operation
(an operation that takes vector and matrix and returns T
)that
- the right hand matrix for the given operationthat
matrixpublic abstract double[] toArray()
public Matrix toRowMatrix()
Vector
toRowMatrix
in class Vector
public Matrix toColumnMatrix()
Vector
toColumnMatrix
in class Vector
public Matrix toDiagonalMatrix()
Vector
toDiagonalMatrix
in class Vector
public String toMatrixMarket(NumberFormat formatter)
Vector
formatter
;toMatrixMarket
in class Vector
formatter
- the number formaterCopyright © 2015. All rights reserved.