public class DatanVector
extends java.lang.Object
Constructor and Description |
---|
DatanVector(DatanVector b)
Creates a vector which is a copy of b.
|
DatanVector(double[] b)
Creates a vector from the array b.
|
DatanVector(int n)
Creates a vector with n elements which are all zero.
|
DatanVector(int n,
double[] b)
Creates a vector with n elements from the array b.
|
Modifier and Type | Method and Description |
---|---|
DatanVector |
add(DatanVector b)
Returns sum with vector b.
|
double |
dot(DatanVector b)
Returns scalar product with vector b.
|
double |
getElement(int i)
Returns elements i.
|
int |
getNumberOfElements()
Returns the number of elements.
|
DatanVector |
getSubvector(int[] list)
Returns subvector defined by a list.
|
DatanVector |
multiply(double s)
Returns product with scalar s.
|
double |
norm()
Returns Euclidean norm.
|
void |
putSubvector(DatanVector b,
int[] list)
Replaces elements according to a list.
|
void |
setElement(int i,
double in)
Sets element i to in.
|
DatanVector |
sub(DatanVector b)
Returns original vector minus vector b.
|
java.lang.String |
toString()
Writes the DatanVector onto a string, using 5 fraction digits.
|
java.lang.String |
toString(java.lang.String fmt)
Writes the DatanVector onto a string.
|
void |
write()
Writes the DatanVector on standard output.
|
public DatanVector(int n)
public DatanVector(int n, double[] b)
public DatanVector(double[] b)
public DatanVector(DatanVector b)
public int getNumberOfElements()
public double getElement(int i)
public void setElement(int i, double in)
public DatanVector add(DatanVector b)
public DatanVector sub(DatanVector b)
public DatanVector multiply(double s)
public DatanVector getSubvector(int[] list)
list
- array with same number of elements as vector,
element has to be 1 if corresponding element of vector is to become element of subvector.public void putSubvector(DatanVector b, int[] list)
list
- array with same number of elements as vector,
element has to be 1 if corresponding element of original vector is to be replaced by element of subvector.public double dot(DatanVector b)
public double norm()
public void write()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String fmt)
fmt
- formatstring, e.g., "%15.10f"