mathcomp.la
Class Vector

java.lang.Object
  extended by mathcomp.la.Vector
Direct Known Subclasses:
MapVector

public abstract class Vector
extends java.lang.Object

A vector based on an index. To access the elements use the methods get(Object i) and set(Object i, double value).

Author:
pht

Constructor Summary
Vector()
           
 
Method Summary
 void add(java.lang.Object i, double x)
          Performs this(i) = this(i) + x.
 Vector add(Vector v, Vector res)
          Performs res := this + v and returns res.
 Vector addScaled(Vector v, double alpha, Vector res)
          Performs res := this + alpha*v and returns res.
abstract  Vector copy()
          Creates a copy of this vector.
 void copyFrom(Vector v)
          Puts v into this, this := v.
abstract  double get(java.lang.Object i)
          Returns the value in the row i.
abstract  Index getIndex()
           
 double normL2()
          Returns the $L^2$-Norm of this vector.
 double normMax()
          Returns the max-Norm of this vector.
 Vector scale(double alpha, Vector res)
          Performs res := alpha*this and returns res.
 double scalProd(Vector v)
          Returns the scalar product of this and v.
abstract  void set(java.lang.Object i, double x)
          Sets the value at i to x.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Vector

public Vector()
Method Detail

getIndex

public abstract Index getIndex()

get

public abstract double get(java.lang.Object i)
Returns the value in the row i.

Parameters:
i - index of the row
Returns:
value at i

set

public abstract void set(java.lang.Object i,
                         double x)
Sets the value at i to x.

Parameters:
i - index of the row
x - value to set

copy

public abstract Vector copy()
Creates a copy of this vector.

Returns:
a copy of this vector

copyFrom

public void copyFrom(Vector v)
Puts v into this, this := v.

Parameters:
v - the vector with the data. Is not changed.

scalProd

public double scalProd(Vector v)
Returns the scalar product of this and v.

Parameters:
v - the
Returns:
the scalar product of this and v

add

public Vector add(Vector v,
                  Vector res)
Performs res := this + v and returns res. As long as none of the vectors are null, there is no problem if two or three of the vectors are the same.

Parameters:
v - the vector to add, may be this or res
res - the vector that will contain the result, may be this or v
Returns:
res := this + v

addScaled

public Vector addScaled(Vector v,
                        double alpha,
                        Vector res)
Performs res := this + alpha*v and returns res. As long as none of the vectors are null, there is no problem if two or three of the vectors are the same.

Parameters:
v - the vector to add, may be this or res
alpha - coefficient for v
res - the vector that will contain the result, may be this or v
Returns:
res := this + alpha*v

scale

public Vector scale(double alpha,
                    Vector res)
Performs res := alpha*this and returns res. res may be this.

Parameters:
alpha - coefficient
res - the vector that will contain the result, may be this
Returns:
res := alpha * this

normL2

public double normL2()
Returns the $L^2$-Norm of this vector.

Returns:
the $L^2$-Norm of this vector

normMax

public double normMax()
Returns the max-Norm of this vector.

Returns:
the max-Norm of this vector

add

public void add(java.lang.Object i,
                double x)
Performs this(i) = this(i) + x.

Parameters:
i - index of the row
x - the value to add