Class RowVector
- java.lang.Object
-
- org.hortonmachine.gears.utils.math.matrixes.Matrix
-
- org.hortonmachine.gears.utils.math.matrixes.RowVector
-
public class RowVector extends Matrix
From: Java Number Cruncher The Java Programmer's Guide to Numerical Computation by Ronald Mak
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RowVectoradd(RowVector rv)Add another row vector to this row 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 row vector from an array of values.voidset(int i, double value)Set the i'th value of the vector.intsize()Return the row vector's size.RowVectorsubtract(RowVector rv)Subtract another row vector from this row vector.
-
-
-
Method Detail
-
size
public int size()
Return the row vector's size.
-
copyValues1D
public double[] copyValues1D()
Copy the values of this matrix.- Returns:
- the copied values
-
at
public double at(int i)
Return the i'th value of the vector.- Parameters:
i- the index- Returns:
- the value
-
set
protected void set(double[] values)
Set this row vector from an array of values.- Parameters:
values- the array of values
-
set
public void set(int i, double value)Set the i'th value of the vector.- Parameters:
i- the indexvalue- the value
-
add
public RowVector add(RowVector rv) throws MatrixException
Add another row vector to this row vector.- Parameters:
rv- the other row vector- Returns:
- the sum row vector
- Throws:
numbercruncher.MatrixException- for invalid sizeMatrixException
-
subtract
public RowVector subtract(RowVector rv) throws MatrixException
Subtract another row vector from this row vector.- Parameters:
rv- the other row vector- Returns:
- the sum row 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.
-
-