|
||||||||||
| 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-zeros
public 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 SparseVectorpublic SparseVector(Vector x)
x - Vector to copy from. A deep copy is madepublic SparseVector(int size)
size - Size of the vector
public 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 internally
public 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 array| Method Detail |
|---|
public void set(int index,
double value)
Vectorx(index) = value
set in interface Vectorset in class AbstractVector
public void add(int index,
double value)
Vectorx(index) += value
add in interface Vectoradd in class AbstractVectorpublic double get(int index)
Vectorx(index)
get in interface Vectorget in class AbstractVectorpublic SparseVector copy()
Vector
copy in interface Vectorcopy in class AbstractVectorpublic SparseVector zero()
Vector
zero in interface Vectorzero in class AbstractVectorpublic SparseVector scale(double alpha)
Vectorx=alpha*x
scale in interface Vectorscale in class AbstractVectorpublic double dot(Vector y)
VectorxT*y
dot in interface Vectordot in class AbstractVectorprotected double norm1()
norm1 in class AbstractVectorprotected double norm2()
norm2 in class AbstractVectorprotected double norm2_robust()
norm2_robust in class AbstractVectorprotected double normInf()
normInf in class AbstractVectorpublic double[] getData()
public int[] getIndex()
getIndex in interface ISparseVectorpublic int getUsed()
getUsed in interface ISparseVectorpublic void compact()
public java.util.Iterator<VectorEntry> iterator()
iterator in interface java.lang.Iterable<VectorEntry>iterator in class AbstractVectorpublic Vector set(Vector y)
Vectorx=y
set in interface Vectorset in class AbstractVector
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||