WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
frc::ct_matrix< Scalar, Rows, Cols > Class Template Reference

Compile-time wrapper for Eigen::Matrix. More...

#include <frc/ct_matrix.h>

Public Member Functions

constexpr ct_matrix ()=default
 
constexpr ct_matrix (std::initializer_list< std::initializer_list< Scalar > > list)
 Constructs a scalar VariableMatrix from a nested list of Variables.
 
template<typename Derived >
requires std::derived_from<Derived, Eigen::MatrixBase<Derived>>
constexpr ct_matrix (const Derived &mat)
 
constexpr int rows () const
 Returns number of rows.
 
constexpr int cols () const
 Returns number of columns.
 
constexpr const Scalar & operator() (int row, int col) const
 Returns reference to matrix element.
 
constexpr Scalar & operator() (int row, int col)
 Returns reference to matrix element.
 
constexpr const Scalar & operator() (int index) const
 Returns reference to matrix element.
 
constexpr Scalar & operator() (int index)
 Returns reference to matrix element.
 
constexpr ct_matrix< Scalar, Cols, Rows > transpose () const
 Constexpr version of Eigen's transpose member function.
 
template<int RhsRows, int RhsCols>
requires (Rows == 1 || Cols == 1) && (RhsRows == 1 || RhsCols == 1) && (Rows * Cols == RhsRows * RhsCols)
constexpr Scalar dot (const ct_matrix< Scalar, RhsRows, RhsCols > &rhs) const
 Constexpr version of Eigen's vector dot member function.
 
constexpr Scalar norm () const
 Constexpr version of Eigen's norm member function.
 
constexpr ct_matrix< Scalar, 3, 1 > cross (const ct_matrix< Scalar, 3, 1 > &rhs)
 Constexpr version of Eigen's 3D vector cross member function.
 
constexpr Scalar determinant () const
 Constexpr version of Eigen's 2x2 matrix determinant member function.
 
constexpr Scalar determinant () const
 Constexpr version of Eigen's 3x3 matrix determinant member function.
 
constexpr const Eigen::Matrix< Scalar, Rows, Cols > & storage () const
 Returns the internal Eigen matrix.
 
constexpr operator Eigen::Matrix< Scalar, Rows, Cols > () const
 Implicit cast to an Eigen matrix.
 

Static Public Member Functions

static constexpr ct_matrix< Scalar, Rows, Cols > Identity ()
 Constexpr version of Eigen's identity function.
 

Friends

constexpr ct_matrix< Scalar, Rows, Cols > operator* (Scalar lhs, const ct_matrix< Scalar, Rows, Cols > &rhs)
 Constexpr version of Eigen's scalar multiplication operator.
 
template<int Cols2>
constexpr ct_matrix< Scalar, Rows, Cols2 > operator* (const ct_matrix< Scalar, Rows, Cols > &lhs, const ct_matrix< Scalar, Rows, Cols2 > &rhs)
 Constexpr version of Eigen's matrix multiplication operator.
 
constexpr ct_matrix< Scalar, Rows, Cols > operator+ (const ct_matrix< Scalar, Rows, Cols > &lhs, const ct_matrix< Scalar, Rows, Cols > &rhs)
 Constexpr version of Eigen's matrix addition operator.
 
constexpr ct_matrix< Scalar, Rows, Cols > operator- (const ct_matrix< Scalar, Rows, Cols > &lhs, const ct_matrix< Scalar, Rows, Cols > &rhs)
 Constexpr version of Eigen's matrix subtraction operator.
 

Detailed Description

template<typename Scalar, int Rows, int Cols>
class frc::ct_matrix< Scalar, Rows, Cols >

Compile-time wrapper for Eigen::Matrix.

Template Parameters
RowsRows of matrix.
ColsColumns of matrix.

Constructor & Destructor Documentation

◆ ct_matrix() [1/3]

template<typename Scalar , int Rows, int Cols>
frc::ct_matrix< Scalar, Rows, Cols >::ct_matrix ( )
constexprdefault

◆ ct_matrix() [2/3]

template<typename Scalar , int Rows, int Cols>
frc::ct_matrix< Scalar, Rows, Cols >::ct_matrix ( std::initializer_list< std::initializer_list< Scalar > > list)
inlineconstexpr

Constructs a scalar VariableMatrix from a nested list of Variables.

Parameters
listThe nested list of Variables.

◆ ct_matrix() [3/3]

template<typename Scalar , int Rows, int Cols>
template<typename Derived >
requires std::derived_from<Derived, Eigen::MatrixBase<Derived>>
frc::ct_matrix< Scalar, Rows, Cols >::ct_matrix ( const Derived & mat)
inlineconstexpr

Member Function Documentation

◆ cols()

template<typename Scalar , int Rows, int Cols>
int frc::ct_matrix< Scalar, Rows, Cols >::cols ( ) const
inlineconstexpr

Returns number of columns.

Returns
Number of columns.

◆ cross()

template<typename Scalar , int Rows, int Cols>
ct_matrix< Scalar, 3, 1 > frc::ct_matrix< Scalar, Rows, Cols >::cross ( const ct_matrix< Scalar, 3, 1 > & rhs)
inlineconstexpr

Constexpr version of Eigen's 3D vector cross member function.

Parameters
rhsRHS vector.
Returns
Cross product of two vectors.

◆ determinant() [1/2]

template<typename Scalar , int Rows, int Cols>
Scalar frc::ct_matrix< Scalar, Rows, Cols >::determinant ( ) const
inlineconstexpr

Constexpr version of Eigen's 2x2 matrix determinant member function.

Returns
Determinant of matrix.

◆ determinant() [2/2]

template<typename Scalar , int Rows, int Cols>
Scalar frc::ct_matrix< Scalar, Rows, Cols >::determinant ( ) const
inlineconstexpr

Constexpr version of Eigen's 3x3 matrix determinant member function.

Returns
Determinant of matrix.

◆ dot()

template<typename Scalar , int Rows, int Cols>
template<int RhsRows, int RhsCols>
requires (Rows == 1 || Cols == 1) && (RhsRows == 1 || RhsCols == 1) && (Rows * Cols == RhsRows * RhsCols)
Scalar frc::ct_matrix< Scalar, Rows, Cols >::dot ( const ct_matrix< Scalar, RhsRows, RhsCols > & rhs) const
inlineconstexpr

Constexpr version of Eigen's vector dot member function.

Template Parameters
RhsRowsRows of RHS vector.
RhsColsColumns of RHS vector.
Parameters
rhsRHS vector.
Returns
Dot product of two vectors.

◆ Identity()

template<typename Scalar , int Rows, int Cols>
static constexpr ct_matrix< Scalar, Rows, Cols > frc::ct_matrix< Scalar, Rows, Cols >::Identity ( )
inlinestaticconstexpr

Constexpr version of Eigen's identity function.

Returns
Identity matrix of the specified size.

◆ norm()

template<typename Scalar , int Rows, int Cols>
Scalar frc::ct_matrix< Scalar, Rows, Cols >::norm ( ) const
inlineconstexpr

Constexpr version of Eigen's norm member function.

Returns
Norm of matrix.

◆ operator Eigen::Matrix< Scalar, Rows, Cols >()

template<typename Scalar , int Rows, int Cols>
frc::ct_matrix< Scalar, Rows, Cols >::operator Eigen::Matrix< Scalar, Rows, Cols > ( ) const
inlineconstexpr

Implicit cast to an Eigen matrix.

◆ operator()() [1/4]

template<typename Scalar , int Rows, int Cols>
Scalar & frc::ct_matrix< Scalar, Rows, Cols >::operator() ( int index)
inlineconstexpr

Returns reference to matrix element.

Parameters
indexIndex.

◆ operator()() [2/4]

template<typename Scalar , int Rows, int Cols>
const Scalar & frc::ct_matrix< Scalar, Rows, Cols >::operator() ( int index) const
inlineconstexpr

Returns reference to matrix element.

Parameters
indexIndex.

◆ operator()() [3/4]

template<typename Scalar , int Rows, int Cols>
Scalar & frc::ct_matrix< Scalar, Rows, Cols >::operator() ( int row,
int col )
inlineconstexpr

Returns reference to matrix element.

Parameters
rowRow index.
colColumn index.

◆ operator()() [4/4]

template<typename Scalar , int Rows, int Cols>
const Scalar & frc::ct_matrix< Scalar, Rows, Cols >::operator() ( int row,
int col ) const
inlineconstexpr

Returns reference to matrix element.

Parameters
rowRow index.
colColumn index.

◆ rows()

template<typename Scalar , int Rows, int Cols>
int frc::ct_matrix< Scalar, Rows, Cols >::rows ( ) const
inlineconstexpr

Returns number of rows.

Returns
Number of rows.

◆ storage()

template<typename Scalar , int Rows, int Cols>
const Eigen::Matrix< Scalar, Rows, Cols > & frc::ct_matrix< Scalar, Rows, Cols >::storage ( ) const
inlineconstexpr

Returns the internal Eigen matrix.

Returns
The internal Eigen matrix.

◆ transpose()

template<typename Scalar , int Rows, int Cols>
ct_matrix< Scalar, Cols, Rows > frc::ct_matrix< Scalar, Rows, Cols >::transpose ( ) const
inlineconstexpr

Constexpr version of Eigen's transpose member function.

Returns
Transpose of matrix.

Friends And Related Symbol Documentation

◆ operator* [1/2]

template<typename Scalar , int Rows, int Cols>
template<int Cols2>
ct_matrix< Scalar, Rows, Cols2 > operator* ( const ct_matrix< Scalar, Rows, Cols > & lhs,
const ct_matrix< Scalar, Rows, Cols2 > & rhs )
friend

Constexpr version of Eigen's matrix multiplication operator.

Template Parameters
Cols2Columns of RHS matrix.
Parameters
lhsLHS matrix.
rhsRHS matrix.
Returns
Result of multiplication.

◆ operator* [2/2]

template<typename Scalar , int Rows, int Cols>
ct_matrix< Scalar, Rows, Cols > operator* ( Scalar lhs,
const ct_matrix< Scalar, Rows, Cols > & rhs )
friend

Constexpr version of Eigen's scalar multiplication operator.

Parameters
lhsLHS scalar.
rhsRHS matrix.
Returns
Result of multiplication.

◆ operator+

template<typename Scalar , int Rows, int Cols>
ct_matrix< Scalar, Rows, Cols > operator+ ( const ct_matrix< Scalar, Rows, Cols > & lhs,
const ct_matrix< Scalar, Rows, Cols > & rhs )
friend

Constexpr version of Eigen's matrix addition operator.

Parameters
lhsLHS matrix.
rhsRHS matrix.
Returns
Result of addition.

◆ operator-

template<typename Scalar , int Rows, int Cols>
ct_matrix< Scalar, Rows, Cols > operator- ( const ct_matrix< Scalar, Rows, Cols > & lhs,
const ct_matrix< Scalar, Rows, Cols > & rhs )
friend

Constexpr version of Eigen's matrix subtraction operator.

Parameters
lhsLHS matrix.
rhsRHS matrix.
Returns
Result of subtraction.

The documentation for this class was generated from the following file: