java.io.Serializable
public class SparseVector
extends java.lang.Object
implements java.io.Serializable
Constructor | Description |
---|---|
SparseVector(int N) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
double |
dot(SparseVector b) |
Calculates the dot product of this vector a with b
|
double |
get(int i) |
get a value
|
int |
nnz() |
|
double |
norm() |
Calculates the 2-norm
|
SparseVector |
plus(SparseVector b) |
Calcualtes return a + b
|
void |
put(int i,
double value) |
Setter method (should it be renamed to set?)
|
SparseVector |
scale(double alpha) |
Calculates alpha * a
|
int |
size() |
|
java.lang.String |
toString() |
public SparseVector(int N)
N
- public void put(int i, double value)
i
- set symbolTable[i]value
- public double get(int i)
i
- public int nnz()
public int size()
public double dot(SparseVector b)
b
- public double norm()
public SparseVector scale(double alpha)
alpha
- public SparseVector plus(SparseVector b)
b
- public java.lang.String toString()
toString
in class java.lang.Object