|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectno.uib.cipr.matrix.AbstractVector
public abstract class AbstractVector
Partial implementation of Vector. The following methods throw
UnsupportedOperationException, and should be overridden by a
subclass:
get(int)set(int,double)copyFor the rest of the methods, simple default implementations using a vector iterator has been provided. There are some kernel operations which the simpler operations forward to, and they are:
add(double,Vector) and set(double,Vector).
scale(double).dot(Vector) and all the norms.
Finally, a default iterator is provided by this class, which works by calling
the get function. A tailored replacement should be used by
subclasses.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface no.uib.cipr.matrix.Vector |
|---|
Vector.Norm |
| Field Summary | |
|---|---|
protected int |
size
Size of the vector |
| Constructor Summary | |
|---|---|
protected |
AbstractVector(int size)
Constructor for AbstractVector. |
protected |
AbstractVector(Vector x)
Constructor for AbstractVector, same size as x |
| Method Summary | |
|---|---|
Vector |
add(double alpha,
Vector y)
x = alpha*y + x |
void |
add(int index,
double value)
x(index) += value |
Vector |
add(Vector y)
x = y + x |
protected void |
check(int index)
Checks the index |
protected void |
checkSize(Vector y)
Checks for conformant sizes |
Vector |
copy()
Creates a deep copy of the vector |
double |
dot(Vector y)
xT*y |
double |
get(int index)
Returns x(index) |
java.util.Iterator<VectorEntry> |
iterator()
|
double |
norm(Vector.Norm type)
Computes the given norm of the vector |
protected double |
norm1()
|
protected double |
norm2_robust()
|
protected double |
norm2()
|
protected double |
normInf()
|
Vector |
scale(double alpha)
x=alpha*x |
Vector |
set(double alpha,
Vector y)
x=alpha*y |
void |
set(int index,
double value)
x(index) = value |
Vector |
set(Vector y)
x=y |
int |
size()
Size of the vector |
java.lang.String |
toString()
|
Vector |
zero()
Zeros all the entries in the vector, while preserving any underlying structure |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int size
| Constructor Detail |
|---|
protected AbstractVector(int size)
size - Size of the vectorprotected AbstractVector(Vector x)
x - Vector to get the size from| Method Detail |
|---|
public int size()
Vector
size in interface Vector
public void set(int index,
double value)
Vectorx(index) = value
set in interface Vector
public void add(int index,
double value)
Vectorx(index) += value
add in interface Vectorpublic double get(int index)
Vectorx(index)
get in interface Vectorpublic Vector copy()
Vector
copy in interface Vectorprotected void check(int index)
public Vector zero()
Vector
zero in interface Vectorpublic Vector scale(double alpha)
Vectorx=alpha*x
scale in interface Vectorpublic Vector set(Vector y)
Vectorx=y
set in interface Vector
public Vector set(double alpha,
Vector y)
Vectorx=alpha*y
set in interface Vectorpublic Vector add(Vector y)
Vectorx = y + x
add in interface Vector
public Vector add(double alpha,
Vector y)
Vectorx = alpha*y + x
add in interface Vectorpublic double dot(Vector y)
VectorxT*y
dot in interface Vectorprotected void checkSize(Vector y)
public double norm(Vector.Norm type)
Vector
norm in interface Vectortype - The type of norm to computeprotected double norm1()
protected double norm2()
protected double norm2_robust()
protected double normInf()
public java.util.Iterator<VectorEntry> iterator()
iterator in interface java.lang.Iterable<VectorEntry>public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||