Class ColumnVector
- java.lang.Object
-
- org.hortonmachine.gears.utils.math.matrixes.Matrix
-
- org.hortonmachine.gears.utils.math.matrixes.ColumnVector
-
public class ColumnVector extends Matrix
From: Java Number Cruncher The Java Programmer's Guide to Numerical Computation by Ronald Mak A column vector.
-
-
Constructor Summary
Constructors Constructor Description ColumnVector(double[] values)Constructor.ColumnVector(int n)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnVectoradd(ColumnVector cv)Add another column vector to this column vector.doubleat(int i)Return the i'th value of the vector.double[]copyValues1D()Copy the values of this matrix.doublenorm()Compute the Euclidean norm.voidprint()Print the vector values.protected voidset(double[] values)Set this column vector from an array of values.voidset(int i, double value)Set the value of the i'th element.intsize()Return this column vector's size.ColumnVectorsubtract(ColumnVector cv)Subtract another column vector from this column vector.
-
-
-
Method Detail
-
size
public int size()
Return this column vector's size.
-
at
public double at(int i)
Return the i'th value of the vector.- Parameters:
i- the index- Returns:
- the value
-
copyValues1D
public double[] copyValues1D()
Copy the values of this matrix.- Returns:
- the copied values
-
set
protected void set(double[] values)
Set this column vector from an array of values.- Parameters:
values- the array of values
-
set
public void set(int i, double value)Set the value of the i'th element.- Parameters:
i- the indexvalue- the value
-
add
public ColumnVector add(ColumnVector cv) throws MatrixException
Add another column vector to this column vector.- Parameters:
cv- the other column vector- Returns:
- the sum column vector
- Throws:
numbercruncher.MatrixException- for invalid sizeMatrixException
-
subtract
public ColumnVector subtract(ColumnVector cv) throws MatrixException
Subtract another column vector from this column vector.- Parameters:
cv- the other column vector- Returns:
- the sum column vector
- Throws:
numbercruncher.MatrixException- for invalid sizeMatrixException
-
norm
public double norm()
Compute the Euclidean norm.- Returns:
- the norm
-
print
public void print()
Print the vector values.
-
-