Package edu.wpi.first.math
Class Vector<R extends Num>
- Type Parameters:
R
- The number of rows in this matrix.
public class Vector<R extends Num> extends Matrix<R,N1>
A shape-safe wrapper over Efficient Java Matrix Library (EJML) matrices.
This class is intended to be used alongside the state space library.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Vector(Matrix<R,N1> other)
Constructs a new vector with the storage of the supplied matrix.Vector(Nat<R> rows)
Constructs an empty zero vector of the given dimensions.Vector(org.ejml.simple.SimpleMatrix storage)
Constructs a newVector
with the given storage. -
Method Summary
Modifier and Type Method Description Vector<R>
div(double value)
Divides all elements of this matrix by the given value.Vector<R>
div(int value)
Divides all elements of this matrix by the given value.double
dot(Vector<R> other)
Returns the dot product of this vector with another.double
norm()
Returns the norm of this vector.Vector<R>
times(double value)
Multiplies all the elements of this matrix by the given scalar.Methods inherited from class edu.wpi.first.math.Matrix
assignBlock, block, block, changeBoundsUnchecked, copy, det, diag, elementPower, elementPower, elementSum, elementTimes, equals, exp, extractColumnVector, extractFrom, extractRowVector, eye, eye, fill, get, getData, getNumCols, getNumRows, getStorage, hashCode, inv, isEqual, isIdentical, lltDecompose, mat, max, maxAbs, mean, minInternal, minus, minus, normF, normIndP1, plus, plus, pow, rankUpdate, set, setColumn, setRow, solve, solveFullPivHouseholderQr, times, toString, trace, transpose
-
Constructor Details
-
Vector
Constructs an empty zero vector of the given dimensions.- Parameters:
rows
- The number of rows of the vector.
-
Vector
Constructs a newVector
with the given storage. Caller should make sure that the provided generic bounds match the shape of the providedVector
.NOTE:It is not recommended to use this constructor unless the
SimpleMatrix
API is absolutely necessary due to the desired function not being accessible through theVector
wrapper.- Parameters:
storage
- TheSimpleMatrix
to back this vector.
-
Vector
Constructs a new vector with the storage of the supplied matrix.- Parameters:
other
- TheVector
to copy the storage of.
-
-
Method Details
-
times
Description copied from class:Matrix
Multiplies all the elements of this matrix by the given scalar. -
div
Description copied from class:Matrix
Divides all elements of this matrix by the given value. -
div
Description copied from class:Matrix
Divides all elements of this matrix by the given value. -
dot
Returns the dot product of this vector with another.- Parameters:
other
- The other vector.- Returns:
- The dot product.
-
norm
Returns the norm of this vector.- Returns:
- The norm.
-