|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfhm.edu.fem.calc.objects.Vector
public class Vector
Class Description: This class represents a vector. Do not confuse it with the Vector class of the Java API which is a thread-safe implementation of ArrayList. The index i starts at 1 not at 0.
Field Summary | |
---|---|
protected double[] |
data
|
protected java.lang.String |
name
|
protected int |
size
|
Constructor Summary | |
---|---|
Vector(java.lang.String name)
Construct a new vector |
|
Vector(java.lang.String name,
double[] array)
Construct a new vector with the given initial data |
|
Vector(java.lang.String name,
int size)
Construct a new vector with the given initiale size |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clone the vector |
java.lang.String |
getName()
Retrieve the name of this matrix |
double |
getValue(int index)
Retrieve a value from the vector |
Vector |
mult(double value)
Multiply all values in the vector with the given value and return the new resulting vector |
Vector |
mult(Matrix matrix,
boolean transponate)
Multiply this vector with the given matrix and return the new resulting vector |
double |
mult(Vector vector)
Multiply this vector with the given vector and return the new resulting vector |
Vector |
normVectorTo(double normValue)
Norm the vector to the given number (meaning: the max value is equal to the given number, all other smaller values are adjusted based on the max value) |
void |
setName(java.lang.String name)
Set a new name for this matrix |
void |
setValue(int index,
double value)
Replace an existing value |
int |
size()
Retrieve the current number of elements in the vector |
java.lang.String |
toString()
toString Implementation |
java.lang.String |
toString(int numberOfValues)
toString Implementation |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double[] data
protected java.lang.String name
protected int size
Constructor Detail |
---|
public Vector(java.lang.String name)
name,
- the name of the vectorpublic Vector(java.lang.String name, double[] array)
name,
- the name of the vectordouble[],
- the data arraypublic Vector(java.lang.String name, int size)
name,
- the name of the vectorsize,
- the number of expected elements in the vectorMethod Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String getName()
public double getValue(int index) throws java.lang.IndexOutOfBoundsException
index,
- the index of the value to retrieve (first index is 1 not 0)
java.lang.IndexOutOfBoundsException
public Vector mult(double value)
value,
- the value to multiply the vector with
public Vector mult(Matrix matrix, boolean transponate) throws java.lang.IndexOutOfBoundsException
matrix,
- the matrix to multiply the vector withboolean,
- true if the vector is transponated, false otherwise
java.lang.IndexOutOfBoundsException
public double mult(Vector vector) throws java.lang.IndexOutOfBoundsException
vector,
- the vector to multiply the vector with
java.lang.IndexOutOfBoundsException
public Vector normVectorTo(double normValue)
normValue,
- the max value to norm to
public void setName(java.lang.String name)
name
- public void setValue(int index, double value) throws java.lang.IndexOutOfBoundsException
index,
- the index of the value (first index is 1 not 0)value,
- the new value
java.lang.IndexOutOfBoundsException
public int size()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int numberOfValues)
int,
- the number of values to display
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |