|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsugr.linalg.VectorImplJama
Vector class. Contains operations of linear algebra: Addition/Substraction, Multiplication, get/set-methods (all double precision floating points), printing.
Construction of vectors is also possible. You are allowed to use LinearAlgebraFactory-methods for constructing matrices and vector. For more information about this class, you are invited to read more in sugr.linalg.LinearAlgebraFactory
Just a note: In further documentation, vector s is synonym for this vector, e.g.:
Vector firstVector; Vector secondVector; Vector r = firstVector.add(secondVector);means for add(Vector v): firstVector is this Vector = s, secondVector is v
Field Summary | |
protected Jama.Matrix |
impl
Jama.Matrix is embedded into this class - all operations are mapped to that. |
private static long |
serialVersionUID
Class version number for serialization |
Constructor Summary | |
VectorImplJama()
standard constructor |
|
VectorImplJama(double[] values)
create a new vector by a given double precision floating point array. |
|
VectorImplJama(int size)
Creates a new vector containing only zeros. |
|
VectorImplJama(Vector v)
create r from s. |
Method Summary | |
java.lang.Object |
clone()
Clone a vector. |
Vector |
copy()
Copies s into a new vector r |
Vector |
crossProduct(Vector v)
calulates the cross product: r = s x v. |
boolean |
equals(java.lang.Object obj)
Test, whether s and v are identical or not |
double |
get(int pos)
Gets an element from s |
Vector |
get(int i0,
int i1)
Get a part of the vector. |
int |
getDim()
Returns the dimension of s |
double |
getLength()
Calculates the length of s. |
Matrix |
getMatrix()
Creates a matrix from s This is a "kind" of typecast. |
Vector |
minus(Vector v)
Substracts to vectors: r = s-v |
Vector |
mult(double f)
Multiplication with scalar: r = a*s |
double |
normF()
Calculates the Frobenius norm of a vector, which is the same as the getLength(). |
double |
normM()
Calculates the maximum norm of a vector |
Vector |
plus(Vector v)
Add two vectors: r = s+v |
void |
print()
Prints this matrix to stdout |
void |
print(int w,
int d)
Prints this matrix to stdout Note:It may be useful to select w > d. |
void |
printMatlab()
Prints this matrix in MATLAB format to stdout |
double |
scalarmult(Vector v)
scalarmultiplication (or dot product)of two vectors: a = s*v, where a is a scalar value |
void |
set(int pos,
double value)
Set an element of s |
void |
set(int pos,
Vector v)
Set a part of a vector |
Matrix |
SkewSym()
Creates a skew-symmetrix matrix from s. s must have dimension 3 to do that. |
java.lang.String |
toString()
Delivers a string with the elements of the matrix. |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final long serialVersionUID
protected Jama.Matrix impl
Constructor Detail |
public VectorImplJama(int size)
size
- Dimension the vector should havepublic VectorImplJama(double[] values)
values
- given in doublepublic VectorImplJama(Vector v)
public VectorImplJama()
Method Detail |
public Vector plus(Vector v)
plus
in interface Vector
v
- vector to add
public Vector minus(Vector v)
minus
in interface Vector
v
- vector to substract
public double scalarmult(Vector v)
scalarmult
in interface Vector
v
- vector to scalarmultiplicate
public Vector crossProduct(Vector v)
crossProduct
in interface Vector
v
- vector to create cross product with
public Vector mult(double f)
mult
in interface Vector
f
- scalar value
public Vector copy()
copy
in interface Vector
public void set(int pos, double value)
set
in interface Vector
pos
- Position to set a new value. First position is 0value
- new value to setpublic void set(int pos, Vector v)
set
in interface Vector
pos
- begining position (inclusive)v
- vector which hold the values to be set. All the values from the
vector are copied to the target.public double get(int pos)
get
in interface Vector
pos
- Position to get element from. Starts with 0
public int getDim()
getDim
in interface Vector
public double getLength()
getLength
in interface Vector
public void print(int w, int d)
print
in interface Vector
w
- describes the width of a single elementd
- number of decimals after commapublic void print()
print
in interface Vector
public void printMatlab()
printMatlab
in interface Vector
public java.lang.String toString()
toString
in interface Vector
public boolean equals(java.lang.Object obj)
equals
in interface Vector
obj
- vector to test
public Matrix getMatrix()
getMatrix
in interface Vector
public Matrix SkewSym()
e.g.: | a | | 0 -c b | if s = | b | , then s.Skewsym() returns | c 0 -a | | c | | -b a 0 |This matrix can be read as a cross product.
SkewSym
in interface Vector
public Vector get(int i0, int i1)
get
in interface Vector
i0
- index of first vector elementi1
- index of the last vector element
public double normF()
normF
in interface Vector
public double normM()
normM
in interface Vector
public java.lang.Object clone()
clone
in interface Vector
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |