Package edu.wpi.first.wpiutil.math
Class MatrixUtils
- java.lang.Object
-
- edu.wpi.first.wpiutil.math.MatrixUtils
-
public final class MatrixUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <D extends Num>
Matrix<D,D>eye(Nat<D> dim)Creates the identity matrix of the given dimension.static <R extends Num,C extends Num>
MatBuilder<R,C>mat(Nat<R> rows, Nat<C> cols)Entrypoint to the MatBuilder class for creation of custom matrices with the given dimensions and contents.static <D extends Num>
VecBuilder<D>vec(Nat<D> dim)Entrypoint to the VecBuilder class for creation of custom vectors with the given size and contents.static <N extends Num>
Matrix<N,N1>zeros(Nat<N> nums)Creates a new vector of zeros.static <R extends Num,C extends Num>
Matrix<R,C>zeros(Nat<R> rows, Nat<C> cols)Creates a new matrix of zeros.
-
-
-
Method Detail
-
zeros
public static <R extends Num,C extends Num> Matrix<R,C> zeros(Nat<R> rows, Nat<C> cols)
Creates a new matrix of zeros.- Type Parameters:
R- The number of rows in the matrix as a generic.C- The number of columns in the matrix as a generic.- Parameters:
rows- The number of rows in the matrix.cols- The number of columns in the matrix.- Returns:
- An RxC matrix filled with zeros.
-
zeros
public static <N extends Num> Matrix<N,N1> zeros(Nat<N> nums)
Creates a new vector of zeros.- Type Parameters:
N- The size of the desired vector as a generic.- Parameters:
nums- The size of the desired vector.- Returns:
- A vector of size N filled with zeros.
-
eye
public static <D extends Num> Matrix<D,D> eye(Nat<D> dim)
Creates the identity matrix of the given dimension.- Type Parameters:
D- The dimension of the desired matrix as a generic.- Parameters:
dim- The dimension of the desired matrix.- Returns:
- The DxD identity matrix.
-
mat
public static <R extends Num,C extends Num> MatBuilder<R,C> mat(Nat<R> rows, Nat<C> cols)
Entrypoint to the MatBuilder class for creation of custom matrices with the given dimensions and contents.- Type Parameters:
R- The number of rows of the desired matrix as a generic.C- The number of columns of the desired matrix as a generic.- Parameters:
rows- The number of rows of the desired matrix.cols- The number of columns of the desired matrix.- Returns:
- A builder to construct the matrix.
-
vec
public static <D extends Num> VecBuilder<D> vec(Nat<D> dim)
Entrypoint to the VecBuilder class for creation of custom vectors with the given size and contents.- Type Parameters:
D- The dimension of the vector as a generic.- Parameters:
dim- The dimension of the vector.- Returns:
- A builder to construct the vector.
-
-