|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.uib.cipr.matrix.AbstractVector
no.uib.cipr.matrix.sparse.SparseVector
public class SparseVector
Sparse vector
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface no.uib.cipr.matrix.Vector |
---|
Vector.Norm |
Field Summary |
---|
Fields inherited from class no.uib.cipr.matrix.AbstractVector |
---|
size |
Constructor Summary | |
---|---|
SparseVector(int size)
Constructor for SparseVector. |
|
SparseVector(int size,
int nz)
Constructor for SparseVector. |
|
SparseVector(int size,
int[] index,
double[] data)
Constructor for SparseVector |
|
SparseVector(int size,
int[] index,
double[] data,
boolean deep)
Constructor for SparseVector |
|
SparseVector(Vector x)
Constructor for SparseVector, and copies the contents from the supplied vector. |
|
SparseVector(Vector x,
boolean deep)
Constructor for SparseVector, and copies the contents from the supplied vector. |
Method Summary | |
---|---|
void |
add(int index,
double value)
x(index) += value |
void |
compact()
Compacts the vector |
SparseVector |
copy()
Creates a deep copy of the vector |
double |
dot(Vector y)
xT*y |
double |
get(int index)
Returns x(index) |
double[] |
getData()
Returns the internal data |
int[] |
getIndex()
Returns the indices |
int |
getUsed()
Number of entries used in the sparse structure |
java.util.Iterator<VectorEntry> |
iterator()
|
protected double |
norm1()
|
protected double |
norm2_robust()
|
protected double |
norm2()
|
protected double |
normInf()
|
SparseVector |
scale(double alpha)
x=alpha*x |
void |
set(int index,
double value)
x(index) = value |
Vector |
set(Vector y)
x=y |
SparseVector |
zero()
Zeros all the entries in the vector, while preserving any underlying structure |
Methods inherited from class no.uib.cipr.matrix.AbstractVector |
---|
add, add, check, checkSize, norm, set, size, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface no.uib.cipr.matrix.Vector |
---|
add, add, norm, set, size |
Constructor Detail |
---|
public SparseVector(int size, int nz)
size
- Size of the vectornz
- Initial number of non-zerospublic SparseVector(Vector x, boolean deep)
x
- Vector to copy fromdeep
- True if a deep copy is to be made. If the copy is shallow,
x
must be a SparseVector
public SparseVector(Vector x)
x
- Vector to copy from. A deep copy is madepublic SparseVector(int size)
size
- Size of the vectorpublic SparseVector(int size, int[] index, double[] data, boolean deep)
size
- Size of the vectorindex
- Indices of the vectordata
- Entries of the vectordeep
- True for a deep copy. For shallow copies, the given indices
will be used internallypublic SparseVector(int size, int[] index, double[] data)
size
- Size of the vectorindex
- The vector indices are copies from this arraydata
- The vector entries are copies from this arrayMethod Detail |
---|
public void set(int index, double value)
Vector
x(index) = value
set
in interface Vector
set
in class AbstractVector
public void add(int index, double value)
Vector
x(index) += value
add
in interface Vector
add
in class AbstractVector
public double get(int index)
Vector
x(index)
get
in interface Vector
get
in class AbstractVector
public SparseVector copy()
Vector
copy
in interface Vector
copy
in class AbstractVector
public SparseVector zero()
Vector
zero
in interface Vector
zero
in class AbstractVector
public SparseVector scale(double alpha)
Vector
x=alpha*x
scale
in interface Vector
scale
in class AbstractVector
public double dot(Vector y)
Vector
xT*y
dot
in interface Vector
dot
in class AbstractVector
protected double norm1()
norm1
in class AbstractVector
protected double norm2()
norm2
in class AbstractVector
protected double norm2_robust()
norm2_robust
in class AbstractVector
protected double normInf()
normInf
in class AbstractVector
public double[] getData()
public int[] getIndex()
getIndex
in interface ISparseVector
public int getUsed()
getUsed
in interface ISparseVector
public void compact()
public java.util.Iterator<VectorEntry> iterator()
iterator
in interface java.lang.Iterable<VectorEntry>
iterator
in class AbstractVector
public Vector set(Vector y)
Vector
x=y
set
in interface Vector
set
in class AbstractVector
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |