Class Vector
java.lang.Object
ch.nolix.base.math.algebra.Vector
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic VectorfromArray(double[] values) doubledoublegetProduct(double factor) intgetSize()doublegetValueAtOneBasedIndex(int oneBasedIndex) inthashCode()booleanhasSameSizeAs(Vector vector) double[]toArray()toString()static VectorwithValues(double... values)
-
Field Details
-
EMPTY_VECTOR
-
-
Method Details
-
fromArray
-
withValues
- Parameters:
values-- Returns:
- a new
Vectorwith the given values. - Throws:
RuntimeException- if the given values is null.
-
equals
-
getEuclidNorm
public double getEuclidNorm()- Returns:
- the euclid norm of the current
Vector.
-
getManhattanNorm
public double getManhattanNorm()- Returns:
- the Manhattan norm of the current
Vector.
-
getProduct
-
getSize
public int getSize()- Returns:
- the size of the current
Vector.
-
getSum
-
getValueAtOneBasedIndex
public double getValueAtOneBasedIndex(int oneBasedIndex) - Parameters:
oneBasedIndex-- Returns:
- the value of the current
Vectorat the given oneBasedIndex. - Throws:
RuntimeException- if the given oneBasedIndex is not positive or the given oneBasedIndex is bigger than the size of the currentVector.
-
hashCode
-
hasSameSizeAs
-
toArray
public double[] toArray()- Returns:
- an array with the values of the current
Vector
-
toString
-