Class Vector<R extends Num>
java.lang.Object
org.wpilib.math.linalg.Matrix<R,N1>
org.wpilib.math.linalg.Vector<R>
- Type Parameters:
R- The number of rows in this matrix.
- All Implemented Interfaces:
ProtobufSerializable, StructSerializable, WPISerializable
public class Vector<R extends Num>
extends Matrix<R,N1>
implements ProtobufSerializable, StructSerializable
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 -
Method Summary
Modifier and TypeMethodDescriptionReturns the cross product of 3 dimensional vectors a and b.div(double value) Divides all elements of this matrix by the given value.div(int value) Divides all elements of this matrix by the given value.doubleReturns the dot product of this vector with another.doubleget(int row) Returns an element of the vector at a specified row.static final <R extends Num>
VectorProto<R> Creates an implementation of theProtobufinterface for vectors.static final <R extends Num>
VectorStruct<R> Creates an implementation of theStructinterface for vectors.Subtracts the given vector to this vector.doublenorm()Returns the norm of this vector.Adds the given vector to this vector.projection(Vector<R> other) Returns the projection of this vector along another.times(double value) Multiplies all the elements of this matrix by the given scalar.unit()Returns the unit vector parallel with this vector.Methods inherited from class Matrix
assignBlock, block, block, changeBoundsUnchecked, copy, det, diag, elementPower, elementPower, elementSum, elementTimes, equals, exp, extractColumnVector, extractFrom, extractRowVector, eye, eye, fill, get, getData, getNumCols, getNumRows, getProto, getStorage, getStruct, hashCode, inv, isEqual, isIdentical, lltDecompose, max, maxAbs, mean, minInternal, minus, minus, normF, normIndP1, plus, plus, pow, rankUpdate, set, setColumn, setRow, solve, solveFullPivHouseholderQr, times, toString, trace, transpose
-
Constructor Details
-
Vector
-
Vector
Constructs a newVectorwith 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
SimpleMatrixAPI is absolutely necessary due to the desired function not being accessible through theVectorwrapper.- Parameters:
storage- TheSimpleMatrixto back this vector.
-
Vector
-
-
Method Details
-
get
Returns an element of the vector at a specified row.- Parameters:
row- The row that the element is located at.- Returns:
- An element of the vector.
-
times
Description copied from class:MatrixMultiplies all the elements of this matrix by the given scalar. -
div
-
div
-
plus
-
minus
-
dot
-
norm
-
unit
-
projection
Returns the projection of this vector along another.- Parameters:
other- The vector to project along.- Returns:
- The projection.
-
cross
-
getProto
Creates an implementation of theProtobufinterface for vectors.- Type Parameters:
R- The number of rows of the vectors this serializer processes.- Parameters:
rows- The number of rows of the vectors this serializer processes.- Returns:
- The protobuf implementation.
-
getStruct
Creates an implementation of theStructinterface for vectors.- Type Parameters:
R- The number of rows of the vectors this serializer processes.- Parameters:
rows- The number of rows of the vectors this serializer processes.- Returns:
- The struct implementation.
-