|
||||||||||
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)
copy
For 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 fromMethod Detail |
---|
public int size()
Vector
size
in interface Vector
public void set(int index, double value)
Vector
x(index) = value
set
in interface Vector
public void add(int index, double value)
Vector
x(index) += value
add
in interface Vector
public double get(int index)
Vector
x(index)
get
in interface Vector
public Vector copy()
Vector
copy
in interface Vector
protected void check(int index)
public Vector zero()
Vector
zero
in interface Vector
public Vector scale(double alpha)
Vector
x=alpha*x
scale
in interface Vector
public Vector set(Vector y)
Vector
x=y
set
in interface Vector
public Vector set(double alpha, Vector y)
Vector
x=alpha*y
set
in interface Vector
public Vector add(Vector y)
Vector
x = y + x
add
in interface Vector
public Vector add(double alpha, Vector y)
Vector
x = alpha*y + x
add
in interface Vector
public double dot(Vector y)
Vector
xT*y
dot
in interface Vector
protected void checkSize(Vector y)
public double norm(Vector.Norm type)
Vector
norm
in interface Vector
type
- 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 |