public class Vector extends Object implements Serializable, Measurable
| Modifier and Type | Class and Description |
|---|---|
static class |
Vector.Type |
| Modifier and Type | Field and Description |
|---|---|
(package private) int |
length |
(package private) int |
max_index |
(package private) HashMap<Integer,Double> |
pairs |
(package private) double |
scale |
private static long |
serialVersionUID |
(package private) double |
snorm |
(package private) Vector.Type |
type |
(package private) double[] |
vals |
| Constructor and Description |
|---|
Vector()
Creates a sparse vector.
|
Vector(double[] vals)
Creates a dense vector from the given values.
|
Vector(double[] vals,
boolean copy) |
Vector(HashMap<Integer,Double> pairs)
Creates a sparse vector from a HashMap
|
Vector(HashMap<Integer,Double> pairs,
boolean copy) |
Vector(int length)
Creates a dense vector of the specified length.
|
Vector(int[] index,
double[] vals)
Creates a sparse vector from the given indices and values.
|
Vector(int[] index,
double[] vals,
int length)
Creates a dense vector filling the values in the given indices of
non-zero entries.
|
Vector(Vector x)
A copy constructor
|
| Modifier and Type | Method and Description |
|---|---|
Vector |
add(double factor,
Vector x) |
Vector |
add(Vector x) |
static Vector |
createSparseVector(Data datum) |
double |
get(int i) |
double |
getByteSize() |
HashMap<Integer,Double> |
getPairs() |
Vector.Type |
getType() |
double |
innerProduct(Vector x) |
boolean |
isSparse() |
int |
length() |
double |
norm() |
Vector |
scale(double s) |
void |
set(int j,
double d) |
double |
snorm() |
String |
toString() |
private static final long serialVersionUID
Vector.Type type
double scale
double snorm
int max_index
double[] vals
int length
public Vector()
public Vector(int length)
length - public Vector(int[] index,
double[] vals)
index - vals - public Vector(double[] vals)
vals - public Vector(double[] vals,
boolean copy)
public Vector(HashMap<Integer,Double> pairs)
pairs - copy - public Vector(Vector x)
public Vector(int[] index,
double[] vals,
int length)
index - vals - dimension - ;public Vector.Type getType()
public boolean isSparse()
public int length()
public void set(int j,
double d)
public double get(int i)
public Vector scale(double s)
public double norm()
public double snorm()
public double innerProduct(Vector x)
public double getByteSize()
getByteSize in interface MeasurableCopyright © 2014. All rights reserved.