WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
slp::VariableMatrix< Scalar_ > Class Template Reference

A matrix of autodiff variables. More...

#include </home/runner/work/allwpilib/allwpilib/wpimath/src/main/native/thirdparty/sleipnir/include/sleipnir/autodiff/variable_matrix.hpp>

Inheritance diagram for slp::VariableMatrix< Scalar_ >:
slp::SleipnirBase

Classes

class  iterator
class  const_iterator

Public Types

using Scalar = Scalar_
 Scalar type alias.
using reverse_iterator = std::reverse_iterator<iterator>
using const_reverse_iterator = std::reverse_iterator<const_iterator>

Public Member Functions

 VariableMatrix ()=default
 Constructs an empty VariableMatrix.
 VariableMatrix (int rows)
 Constructs a zero-initialized VariableMatrix column vector with the given rows.
 VariableMatrix (int rows, int cols)
 Constructs a zero-initialized VariableMatrix with the given dimensions.
 VariableMatrix (detail::empty_t, int rows, int cols)
 Constructs an empty VariableMatrix with the given dimensions.
 VariableMatrix (std::initializer_list< std::initializer_list< Variable< Scalar > > > list)
 Constructs a scalar VariableMatrix from a nested list of Variables.
 VariableMatrix (const std::vector< std::vector< Scalar > > &list)
 Constructs a scalar VariableMatrix from a nested list of scalars.
 VariableMatrix (const std::vector< std::vector< Variable< Scalar > > > &list)
 Constructs a scalar VariableMatrix from a nested list of Variables.
template<typename Derived>
 VariableMatrix (const Eigen::MatrixBase< Derived > &values)
 Constructs a VariableMatrix from an Eigen matrix.
template<typename Derived>
 VariableMatrix (const Eigen::DiagonalBase< Derived > &values)
 Constructs a VariableMatrix from an Eigen diagonal matrix.
 VariableMatrix (const Variable< Scalar > &variable)
 Constructs a scalar VariableMatrix from a Variable.
 VariableMatrix (Variable< Scalar > &&variable)
 Constructs a scalar VariableMatrix from a Variable.
 VariableMatrix (const VariableBlock< VariableMatrix > &values)
 Constructs a VariableMatrix from a VariableBlock.
 VariableMatrix (const VariableBlock< const VariableMatrix > &values)
 Constructs a VariableMatrix from a VariableBlock.
 VariableMatrix (std::span< const Variable< Scalar > > values)
 Constructs a column vector wrapper around a Variable array.
 VariableMatrix (std::span< const Variable< Scalar > > values, int rows, int cols)
 Constructs a matrix wrapper around a Variable array.
template<typename Derived>
VariableMatrixoperator= (const Eigen::MatrixBase< Derived > &values)
 Assigns an Eigen matrix to a VariableMatrix.
VariableMatrixoperator= (ScalarLike auto value)
 Assigns a scalar to the matrix.
template<typename Derived>
requires std::same_as<typename Derived::Scalar, Scalar>
void set_value (const Eigen::MatrixBase< Derived > &values)
 Sets the VariableMatrix's internal values.
Variable< Scalar > & operator() (int row, int col)
 Returns the element at the given row and column.
const Variable< Scalar > & operator() (int row, int col) const
 Returns the element at the given row and column.
Variable< Scalar > & operator[] (int index)
 Returns the element at the given index.
const Variable< Scalar > & operator[] (int index) const
 Returns the element at the given index.
VariableBlock< VariableMatrixblock (int row_offset, int col_offset, int block_rows, int block_cols)
 Returns a block of the variable matrix.
const VariableBlock< const VariableMatrixblock (int row_offset, int col_offset, int block_rows, int block_cols) const
 Returns a block of the variable matrix.
VariableBlock< VariableMatrixoperator() (Slice row_slice, Slice col_slice)
 Returns a slice of the variable matrix.
const VariableBlock< const VariableMatrixoperator() (Slice row_slice, Slice col_slice) const
 Returns a slice of the variable matrix.
VariableBlock< VariableMatrixoperator() (Slice row_slice, int row_slice_length, Slice col_slice, int col_slice_length)
 Returns a slice of the variable matrix.
const VariableBlock< const VariableMatrixoperator() (Slice row_slice, int row_slice_length, Slice col_slice, int col_slice_length) const
 Returns a slice of the variable matrix.
VariableBlock< VariableMatrixsegment (int offset, int length)
 Returns a segment of the variable vector.
const VariableBlock< const VariableMatrixsegment (int offset, int length) const
 Returns a segment of the variable vector.
VariableBlock< VariableMatrixrow (int row)
 Returns a row slice of the variable matrix.
const VariableBlock< const VariableMatrixrow (int row) const
 Returns a row slice of the variable matrix.
VariableBlock< VariableMatrixcol (int col)
 Returns a column slice of the variable matrix.
const VariableBlock< const VariableMatrixcol (int col) const
 Returns a column slice of the variable matrix.
VariableMatrixoperator*= (const MatrixLike auto &rhs)
 Compound matrix multiplication-assignment operator.
VariableMatrixoperator*= (const ScalarLike auto &rhs)
 Compound matrix-scalar multiplication-assignment operator.
VariableMatrixoperator/= (const ScalarLike auto &rhs)
 Compound matrix division-assignment operator.
VariableMatrixoperator+= (const MatrixLike auto &rhs)
 Compound addition-assignment operator.
VariableMatrixoperator+= (const ScalarLike auto &rhs)
 Compound addition-assignment operator.
VariableMatrixoperator-= (const MatrixLike auto &rhs)
 Compound subtraction-assignment operator.
VariableMatrixoperator-= (const ScalarLike auto &rhs)
 Compound subtraction-assignment operator.
 operator Variable< Scalar > () const
 Implicit conversion operator from 1x1 VariableMatrix to Variable.
VariableMatrix< ScalarT () const
 Returns the transpose of the variable matrix.
int rows () const
 Returns the number of rows in the matrix.
int cols () const
 Returns the number of columns in the matrix.
Scalar value (int row, int col)
 Returns an element of the variable matrix.
Scalar value (int index)
 Returns an element of the variable matrix.
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > value ()
 Returns the contents of the variable matrix.
VariableMatrix< Scalarcwise_transform (function_ref< Variable< Scalar >(const Variable< Scalar > &x)> unary_op) const
 Transforms the matrix coefficient-wise with an unary operator.
iterator begin ()
 Returns begin iterator.
iterator end ()
 Returns end iterator.
const_iterator begin () const
 Returns const begin iterator.
const_iterator end () const
 Returns const end iterator.
const_iterator cbegin () const
 Returns const begin iterator.
const_iterator cend () const
 Returns const end iterator.
reverse_iterator rbegin ()
 Returns reverse begin iterator.
reverse_iterator rend ()
 Returns reverse end iterator.
const_reverse_iterator rbegin () const
 Returns const reverse begin iterator.
const_reverse_iterator rend () const
 Returns const reverse end iterator.
const_reverse_iterator crbegin () const
 Returns const reverse begin iterator.
const_reverse_iterator crend () const
 Returns const reverse end iterator.
size_t size () const
 Returns number of elements in matrix.

Static Public Member Functions

static VariableMatrix< Scalarzero (int rows, int cols)
 Returns a variable matrix filled with zeroes.
static VariableMatrix< Scalarones (int rows, int cols)
 Returns a variable matrix filled with ones.

Friends

template<EigenMatrixLike LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalaroperator* (const LHS &lhs, const RHS &rhs)
 Matrix multiplication operator.
template<SleipnirMatrixLike< Scalar > LHS, EigenMatrixLike RHS>
VariableMatrix< Scalaroperator* (const LHS &lhs, const RHS &rhs)
 Matrix multiplication operator.
template<SleipnirMatrixLike< Scalar > LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalaroperator* (const LHS &lhs, const RHS &rhs)
 Matrix multiplication operator.
template<EigenMatrixLike LHS>
VariableMatrix< Scalaroperator* (const LHS &lhs, const Variable< Scalar > &rhs)
 Matrix-scalar multiplication operator.
template<SleipnirMatrixLike< Scalar > LHS, ScalarLike RHS>
VariableMatrix< Scalaroperator* (const LHS &lhs, const RHS &rhs)
 Matrix-scalar multiplication operator.
template<EigenMatrixLike RHS>
VariableMatrix< Scalaroperator* (const Variable< Scalar > &lhs, const RHS &rhs)
 Scalar-matrix multiplication operator.
template<ScalarLike LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalaroperator* (const LHS &lhs, const RHS &rhs)
 Scalar-matrix multiplication operator.
template<EigenMatrixLike LHS>
VariableMatrix< Scalaroperator/ (const LHS &lhs, const Variable< Scalar > &rhs)
 Binary division operator.
template<SleipnirMatrixLike< Scalar > LHS, ScalarLike RHS>
requires (!SleipnirScalarLike<RHS, Scalar>)
VariableMatrix< Scalaroperator/ (const LHS &lhs, const RHS &rhs)
 Binary division operator.
template<SleipnirMatrixLike< Scalar > LHS>
VariableMatrix< Scalaroperator/ (const LHS &lhs, const Variable< Scalar > &rhs)
 Binary division operator.
template<EigenMatrixLike LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalaroperator+ (const LHS &lhs, const RHS &rhs)
 Binary addition operator.
template<SleipnirMatrixLike< Scalar > LHS, EigenMatrixLike RHS>
VariableMatrix< Scalaroperator+ (const LHS &lhs, const RHS &rhs)
 Binary addition operator.
template<SleipnirMatrixLike< Scalar > LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalaroperator+ (const LHS &lhs, const RHS &rhs)
 Binary addition operator.
template<EigenMatrixLike LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalaroperator- (const LHS &lhs, const RHS &rhs)
 Binary subtraction operator.
template<SleipnirMatrixLike< Scalar > LHS, EigenMatrixLike RHS>
VariableMatrix< Scalaroperator- (const LHS &lhs, const RHS &rhs)
 Binary subtraction operator.
template<SleipnirMatrixLike< Scalar > LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalaroperator- (const LHS &lhs, const RHS &rhs)
 Binary subtraction operator.
VariableMatrix< Scalaroperator- (const SleipnirMatrixLike< Scalar > auto &lhs)
 Unary minus operator.

Detailed Description

template<typename Scalar_>
class slp::VariableMatrix< Scalar_ >

A matrix of autodiff variables.

Template Parameters
Scalar_Scalar type.

Member Typedef Documentation

◆ const_reverse_iterator

template<typename Scalar_>
using slp::VariableMatrix< Scalar_ >::const_reverse_iterator = std::reverse_iterator<const_iterator>

◆ reverse_iterator

template<typename Scalar_>
using slp::VariableMatrix< Scalar_ >::reverse_iterator = std::reverse_iterator<iterator>

◆ Scalar

template<typename Scalar_>
using slp::VariableMatrix< Scalar_ >::Scalar = Scalar_

Scalar type alias.

Constructor & Destructor Documentation

◆ VariableMatrix() [1/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( )
default

Constructs an empty VariableMatrix.

◆ VariableMatrix() [2/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( int rows)
inlineexplicit

Constructs a zero-initialized VariableMatrix column vector with the given rows.

Parameters
rowsThe number of matrix rows.

◆ VariableMatrix() [3/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( int rows,
int cols )
inline

Constructs a zero-initialized VariableMatrix with the given dimensions.

Parameters
rowsThe number of matrix rows.
colsThe number of matrix columns.

◆ VariableMatrix() [4/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( detail::empty_t ,
int rows,
int cols )
inline

Constructs an empty VariableMatrix with the given dimensions.

Parameters
rowsThe number of matrix rows.
colsThe number of matrix columns.

◆ VariableMatrix() [5/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( std::initializer_list< std::initializer_list< Variable< Scalar > > > list)
inline

Constructs a scalar VariableMatrix from a nested list of Variables.

Parameters
listThe nested list of Variables.

◆ VariableMatrix() [6/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( const std::vector< std::vector< Scalar > > & list)
inline

Constructs a scalar VariableMatrix from a nested list of scalars.

This overload is for Python bindings only.

Parameters
listThe nested list of Variables.

◆ VariableMatrix() [7/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( const std::vector< std::vector< Variable< Scalar > > > & list)
inline

Constructs a scalar VariableMatrix from a nested list of Variables.

This overload is for Python bindings only.

Parameters
listThe nested list of Variables.

◆ VariableMatrix() [8/15]

template<typename Scalar_>
template<typename Derived>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( const Eigen::MatrixBase< Derived > & values)
inline

Constructs a VariableMatrix from an Eigen matrix.

Parameters
valuesEigen matrix of values.

◆ VariableMatrix() [9/15]

template<typename Scalar_>
template<typename Derived>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( const Eigen::DiagonalBase< Derived > & values)
inline

Constructs a VariableMatrix from an Eigen diagonal matrix.

Parameters
valuesDiagonal matrix of values.

◆ VariableMatrix() [10/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( const Variable< Scalar > & variable)
inline

Constructs a scalar VariableMatrix from a Variable.

Parameters
variableVariable.

◆ VariableMatrix() [11/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( Variable< Scalar > && variable)
inline

Constructs a scalar VariableMatrix from a Variable.

Parameters
variableVariable.

◆ VariableMatrix() [12/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( const VariableBlock< VariableMatrix< Scalar_ > > & values)
inline

Constructs a VariableMatrix from a VariableBlock.

Parameters
valuesVariableBlock of values.

◆ VariableMatrix() [13/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( const VariableBlock< const VariableMatrix< Scalar_ > > & values)
inline

Constructs a VariableMatrix from a VariableBlock.

Parameters
valuesVariableBlock of values.

◆ VariableMatrix() [14/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( std::span< const Variable< Scalar > > values)
inlineexplicit

Constructs a column vector wrapper around a Variable array.

Parameters
valuesVariable array to wrap.

◆ VariableMatrix() [15/15]

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::VariableMatrix ( std::span< const Variable< Scalar > > values,
int rows,
int cols )
inline

Constructs a matrix wrapper around a Variable array.

Parameters
valuesVariable array to wrap.
rowsThe number of matrix rows.
colsThe number of matrix columns.

Member Function Documentation

◆ begin() [1/2]

template<typename Scalar_>
iterator slp::VariableMatrix< Scalar_ >::begin ( )
inline

Returns begin iterator.

Returns
Begin iterator.

◆ begin() [2/2]

template<typename Scalar_>
const_iterator slp::VariableMatrix< Scalar_ >::begin ( ) const
inline

Returns const begin iterator.

Returns
Const begin iterator.

◆ block() [1/2]

template<typename Scalar_>
VariableBlock< VariableMatrix > slp::VariableMatrix< Scalar_ >::block ( int row_offset,
int col_offset,
int block_rows,
int block_cols )
inline

Returns a block of the variable matrix.

Parameters
row_offsetThe row offset of the block selection.
col_offsetThe column offset of the block selection.
block_rowsThe number of rows in the block selection.
block_colsThe number of columns in the block selection.
Returns
A block of the variable matrix.

◆ block() [2/2]

template<typename Scalar_>
const VariableBlock< const VariableMatrix > slp::VariableMatrix< Scalar_ >::block ( int row_offset,
int col_offset,
int block_rows,
int block_cols ) const
inline

Returns a block of the variable matrix.

Parameters
row_offsetThe row offset of the block selection.
col_offsetThe column offset of the block selection.
block_rowsThe number of rows in the block selection.
block_colsThe number of columns in the block selection.
Returns
A block of the variable matrix.

◆ cbegin()

template<typename Scalar_>
const_iterator slp::VariableMatrix< Scalar_ >::cbegin ( ) const
inline

Returns const begin iterator.

Returns
Const begin iterator.

◆ cend()

template<typename Scalar_>
const_iterator slp::VariableMatrix< Scalar_ >::cend ( ) const
inline

Returns const end iterator.

Returns
Const end iterator.

◆ col() [1/2]

template<typename Scalar_>
VariableBlock< VariableMatrix > slp::VariableMatrix< Scalar_ >::col ( int col)
inline

Returns a column slice of the variable matrix.

Parameters
colThe column to slice.
Returns
A column slice of the variable matrix.

◆ col() [2/2]

template<typename Scalar_>
const VariableBlock< const VariableMatrix > slp::VariableMatrix< Scalar_ >::col ( int col) const
inline

Returns a column slice of the variable matrix.

Parameters
colThe column to slice.
Returns
A column slice of the variable matrix.

◆ cols()

template<typename Scalar_>
int slp::VariableMatrix< Scalar_ >::cols ( ) const
inline

Returns the number of columns in the matrix.

Returns
The number of columns in the matrix.

◆ crbegin()

template<typename Scalar_>
const_reverse_iterator slp::VariableMatrix< Scalar_ >::crbegin ( ) const
inline

Returns const reverse begin iterator.

Returns
Const reverse begin iterator.

◆ crend()

template<typename Scalar_>
const_reverse_iterator slp::VariableMatrix< Scalar_ >::crend ( ) const
inline

Returns const reverse end iterator.

Returns
Const reverse end iterator.

◆ cwise_transform()

template<typename Scalar_>
VariableMatrix< Scalar > slp::VariableMatrix< Scalar_ >::cwise_transform ( function_ref< Variable< Scalar >(const Variable< Scalar > &x)> unary_op) const
inline

Transforms the matrix coefficient-wise with an unary operator.

Parameters
unary_opThe unary operator to use for the transform operation.
Returns
Result of the unary operator.

◆ end() [1/2]

template<typename Scalar_>
iterator slp::VariableMatrix< Scalar_ >::end ( )
inline

Returns end iterator.

Returns
End iterator.

◆ end() [2/2]

template<typename Scalar_>
const_iterator slp::VariableMatrix< Scalar_ >::end ( ) const
inline

Returns const end iterator.

Returns
Const end iterator.

◆ ones()

template<typename Scalar_>
VariableMatrix< Scalar > slp::VariableMatrix< Scalar_ >::ones ( int rows,
int cols )
inlinestatic

Returns a variable matrix filled with ones.

Parameters
rowsThe number of matrix rows.
colsThe number of matrix columns.
Returns
A variable matrix filled with ones.

◆ operator Variable< Scalar >()

template<typename Scalar_>
slp::VariableMatrix< Scalar_ >::operator Variable< Scalar > ( ) const
inline

Implicit conversion operator from 1x1 VariableMatrix to Variable.

◆ operator()() [1/6]

template<typename Scalar_>
Variable< Scalar > & slp::VariableMatrix< Scalar_ >::operator() ( int row,
int col )
inline

Returns the element at the given row and column.

Parameters
rowThe row.
colThe column.
Returns
The element at the given row and column.

◆ operator()() [2/6]

template<typename Scalar_>
const Variable< Scalar > & slp::VariableMatrix< Scalar_ >::operator() ( int row,
int col ) const
inline

Returns the element at the given row and column.

Parameters
rowThe row.
colThe column.
Returns
The element at the given row and column.

◆ operator()() [3/6]

template<typename Scalar_>
VariableBlock< VariableMatrix > slp::VariableMatrix< Scalar_ >::operator() ( Slice row_slice,
int row_slice_length,
Slice col_slice,
int col_slice_length )
inline

Returns a slice of the variable matrix.

The given slices aren't adjusted. This overload is for Python bindings only.

Parameters
row_sliceThe row slice.
row_slice_lengthThe row slice length.
col_sliceThe column slice.
col_slice_lengthThe column slice length.
Returns
A slice of the variable matrix.

◆ operator()() [4/6]

template<typename Scalar_>
const VariableBlock< const VariableMatrix > slp::VariableMatrix< Scalar_ >::operator() ( Slice row_slice,
int row_slice_length,
Slice col_slice,
int col_slice_length ) const
inline

Returns a slice of the variable matrix.

The given slices aren't adjusted. This overload is for Python bindings only.

Parameters
row_sliceThe row slice.
row_slice_lengthThe row slice length.
col_sliceThe column slice.
col_slice_lengthThe column slice length.
Returns
A slice of the variable matrix.

◆ operator()() [5/6]

template<typename Scalar_>
VariableBlock< VariableMatrix > slp::VariableMatrix< Scalar_ >::operator() ( Slice row_slice,
Slice col_slice )
inline

Returns a slice of the variable matrix.

Parameters
row_sliceThe row slice.
col_sliceThe column slice.
Returns
A slice of the variable matrix.

◆ operator()() [6/6]

template<typename Scalar_>
const VariableBlock< const VariableMatrix > slp::VariableMatrix< Scalar_ >::operator() ( Slice row_slice,
Slice col_slice ) const
inline

Returns a slice of the variable matrix.

Parameters
row_sliceThe row slice.
col_sliceThe column slice.
Returns
A slice of the variable matrix.

◆ operator*=() [1/2]

template<typename Scalar_>
VariableMatrix & slp::VariableMatrix< Scalar_ >::operator*= ( const MatrixLike auto & rhs)
inline

Compound matrix multiplication-assignment operator.

Parameters
rhsVariable to multiply.
Returns
Result of multiplication.

◆ operator*=() [2/2]

template<typename Scalar_>
VariableMatrix & slp::VariableMatrix< Scalar_ >::operator*= ( const ScalarLike auto & rhs)
inline

Compound matrix-scalar multiplication-assignment operator.

Parameters
rhsVariable to multiply.
Returns
Result of multiplication.

◆ operator+=() [1/2]

template<typename Scalar_>
VariableMatrix & slp::VariableMatrix< Scalar_ >::operator+= ( const MatrixLike auto & rhs)
inline

Compound addition-assignment operator.

Parameters
rhsVariable to add.
Returns
Result of addition.

◆ operator+=() [2/2]

template<typename Scalar_>
VariableMatrix & slp::VariableMatrix< Scalar_ >::operator+= ( const ScalarLike auto & rhs)
inline

Compound addition-assignment operator.

Parameters
rhsVariable to add.
Returns
Result of addition.

◆ operator-=() [1/2]

template<typename Scalar_>
VariableMatrix & slp::VariableMatrix< Scalar_ >::operator-= ( const MatrixLike auto & rhs)
inline

Compound subtraction-assignment operator.

Parameters
rhsVariable to subtract.
Returns
Result of subtraction.

◆ operator-=() [2/2]

template<typename Scalar_>
VariableMatrix & slp::VariableMatrix< Scalar_ >::operator-= ( const ScalarLike auto & rhs)
inline

Compound subtraction-assignment operator.

Parameters
rhsVariable to subtract.
Returns
Result of subtraction.

◆ operator/=()

template<typename Scalar_>
VariableMatrix & slp::VariableMatrix< Scalar_ >::operator/= ( const ScalarLike auto & rhs)
inline

Compound matrix division-assignment operator.

Parameters
rhsVariable to divide.
Returns
Result of division.

◆ operator=() [1/2]

template<typename Scalar_>
template<typename Derived>
VariableMatrix & slp::VariableMatrix< Scalar_ >::operator= ( const Eigen::MatrixBase< Derived > & values)
inline

Assigns an Eigen matrix to a VariableMatrix.

Parameters
valuesEigen matrix of values.
Returns
This VariableMatrix.

◆ operator=() [2/2]

template<typename Scalar_>
VariableMatrix & slp::VariableMatrix< Scalar_ >::operator= ( ScalarLike auto value)
inline

Assigns a scalar to the matrix.

This only works for matrices with one row and one column.

Parameters
valueValue to assign.
Returns
This VariableMatrix.

◆ operator[]() [1/2]

template<typename Scalar_>
Variable< Scalar > & slp::VariableMatrix< Scalar_ >::operator[] ( int index)
inline

Returns the element at the given index.

Parameters
indexThe index.
Returns
The element at the given index.

◆ operator[]() [2/2]

template<typename Scalar_>
const Variable< Scalar > & slp::VariableMatrix< Scalar_ >::operator[] ( int index) const
inline

Returns the element at the given index.

Parameters
indexThe index.
Returns
The element at the given index.

◆ rbegin() [1/2]

template<typename Scalar_>
reverse_iterator slp::VariableMatrix< Scalar_ >::rbegin ( )
inline

Returns reverse begin iterator.

Returns
Reverse begin iterator.

◆ rbegin() [2/2]

template<typename Scalar_>
const_reverse_iterator slp::VariableMatrix< Scalar_ >::rbegin ( ) const
inline

Returns const reverse begin iterator.

Returns
Const reverse begin iterator.

◆ rend() [1/2]

template<typename Scalar_>
reverse_iterator slp::VariableMatrix< Scalar_ >::rend ( )
inline

Returns reverse end iterator.

Returns
Reverse end iterator.

◆ rend() [2/2]

template<typename Scalar_>
const_reverse_iterator slp::VariableMatrix< Scalar_ >::rend ( ) const
inline

Returns const reverse end iterator.

Returns
Const reverse end iterator.

◆ row() [1/2]

template<typename Scalar_>
VariableBlock< VariableMatrix > slp::VariableMatrix< Scalar_ >::row ( int row)
inline

Returns a row slice of the variable matrix.

Parameters
rowThe row to slice.
Returns
A row slice of the variable matrix.

◆ row() [2/2]

template<typename Scalar_>
const VariableBlock< const VariableMatrix > slp::VariableMatrix< Scalar_ >::row ( int row) const
inline

Returns a row slice of the variable matrix.

Parameters
rowThe row to slice.
Returns
A row slice of the variable matrix.

◆ rows()

template<typename Scalar_>
int slp::VariableMatrix< Scalar_ >::rows ( ) const
inline

Returns the number of rows in the matrix.

Returns
The number of rows in the matrix.

◆ segment() [1/2]

template<typename Scalar_>
VariableBlock< VariableMatrix > slp::VariableMatrix< Scalar_ >::segment ( int offset,
int length )
inline

Returns a segment of the variable vector.

Parameters
offsetThe offset of the segment.
lengthThe length of the segment.
Returns
A segment of the variable vector.

◆ segment() [2/2]

template<typename Scalar_>
const VariableBlock< const VariableMatrix > slp::VariableMatrix< Scalar_ >::segment ( int offset,
int length ) const
inline

Returns a segment of the variable vector.

Parameters
offsetThe offset of the segment.
lengthThe length of the segment.
Returns
A segment of the variable vector.

◆ set_value()

template<typename Scalar_>
template<typename Derived>
requires std::same_as<typename Derived::Scalar, Scalar>
void slp::VariableMatrix< Scalar_ >::set_value ( const Eigen::MatrixBase< Derived > & values)
inline

Sets the VariableMatrix's internal values.

Parameters
valuesEigen matrix of values.

◆ size()

template<typename Scalar_>
size_t slp::VariableMatrix< Scalar_ >::size ( ) const
inline

Returns number of elements in matrix.

Returns
Number of elements in matrix.

◆ T()

template<typename Scalar_>
VariableMatrix< Scalar > slp::VariableMatrix< Scalar_ >::T ( ) const
inline

Returns the transpose of the variable matrix.

Returns
The transpose of the variable matrix.

◆ value() [1/3]

template<typename Scalar_>
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > slp::VariableMatrix< Scalar_ >::value ( )
inline

Returns the contents of the variable matrix.

Returns
The contents of the variable matrix.

◆ value() [2/3]

template<typename Scalar_>
Scalar slp::VariableMatrix< Scalar_ >::value ( int index)
inline

Returns an element of the variable matrix.

Parameters
indexThe index of the element to return.
Returns
An element of the variable matrix.

◆ value() [3/3]

template<typename Scalar_>
Scalar slp::VariableMatrix< Scalar_ >::value ( int row,
int col )
inline

Returns an element of the variable matrix.

Parameters
rowThe row of the element to return.
colThe column of the element to return.
Returns
An element of the variable matrix.

◆ zero()

template<typename Scalar_>
VariableMatrix< Scalar > slp::VariableMatrix< Scalar_ >::zero ( int rows,
int cols )
inlinestatic

Returns a variable matrix filled with zeroes.

Parameters
rowsThe number of matrix rows.
colsThe number of matrix columns.
Returns
A variable matrix filled with zeroes.

◆ operator* [1/7]

template<typename Scalar_>
template<ScalarLike LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalar > operator* ( const LHS & lhs,
const RHS & rhs )
friend

Scalar-matrix multiplication operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ operator* [2/7]

template<typename Scalar_>
template<SleipnirMatrixLike< Scalar > LHS, ScalarLike RHS>
VariableMatrix< Scalar > operator* ( const LHS & lhs,
const RHS & rhs )
friend

Matrix-scalar multiplication operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ operator* [3/7]

template<typename Scalar_>
template<SleipnirMatrixLike< Scalar > LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalar > operator* ( const LHS & lhs,
const RHS & rhs )
friend

Matrix multiplication operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ operator* [4/7]

template<typename Scalar_>
template<SleipnirMatrixLike< Scalar > LHS, EigenMatrixLike RHS>
VariableMatrix< Scalar > operator* ( const LHS & lhs,
const RHS & rhs )
friend

Matrix multiplication operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ operator* [5/7]

template<typename Scalar_>
template<EigenMatrixLike LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalar > operator* ( const LHS & lhs,
const RHS & rhs )
friend

Matrix multiplication operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ operator* [6/7]

template<typename Scalar_>
template<EigenMatrixLike LHS>
VariableMatrix< Scalar > operator* ( const LHS & lhs,
const Variable< Scalar > & rhs )
friend

Matrix-scalar multiplication operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ operator* [7/7]

template<typename Scalar_>
template<EigenMatrixLike RHS>
VariableMatrix< Scalar > operator* ( const Variable< Scalar > & lhs,
const RHS & rhs )
friend

Scalar-matrix multiplication operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.

◆ operator+ [1/3]

template<typename Scalar_>
template<SleipnirMatrixLike< Scalar > LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalar > operator+ ( const LHS & lhs,
const RHS & rhs )
friend

Binary addition operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.
Returns
Result of addition.

◆ operator+ [2/3]

template<typename Scalar_>
template<SleipnirMatrixLike< Scalar > LHS, EigenMatrixLike RHS>
VariableMatrix< Scalar > operator+ ( const LHS & lhs,
const RHS & rhs )
friend

Binary addition operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.
Returns
Result of addition.

◆ operator+ [3/3]

template<typename Scalar_>
template<EigenMatrixLike LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalar > operator+ ( const LHS & lhs,
const RHS & rhs )
friend

Binary addition operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.
Returns
Result of addition.

◆ operator- [1/4]

template<typename Scalar_>
template<SleipnirMatrixLike< Scalar > LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalar > operator- ( const LHS & lhs,
const RHS & rhs )
friend

Binary subtraction operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.
Returns
Result of subtraction.

◆ operator- [2/4]

template<typename Scalar_>
template<SleipnirMatrixLike< Scalar > LHS, EigenMatrixLike RHS>
VariableMatrix< Scalar > operator- ( const LHS & lhs,
const RHS & rhs )
friend

Binary subtraction operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.
Returns
Result of subtraction.

◆ operator- [3/4]

template<typename Scalar_>
template<EigenMatrixLike LHS, SleipnirMatrixLike< Scalar > RHS>
VariableMatrix< Scalar > operator- ( const LHS & lhs,
const RHS & rhs )
friend

Binary subtraction operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.
Returns
Result of subtraction.

◆ operator- [4/4]

template<typename Scalar_>
VariableMatrix< Scalar > operator- ( const SleipnirMatrixLike< Scalar > auto & lhs)
friend

Unary minus operator.

Parameters
lhsOperand for unary minus.

◆ operator/ [1/3]

template<typename Scalar_>
template<SleipnirMatrixLike< Scalar > LHS, ScalarLike RHS>
requires (!SleipnirScalarLike<RHS, Scalar>)
VariableMatrix< Scalar > operator/ ( const LHS & lhs,
const RHS & rhs )
friend

Binary division operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.
Returns
Result of division.

◆ operator/ [2/3]

template<typename Scalar_>
template<SleipnirMatrixLike< Scalar > LHS>
VariableMatrix< Scalar > operator/ ( const LHS & lhs,
const Variable< Scalar > & rhs )
friend

Binary division operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.
Returns
Result of division.

◆ operator/ [3/3]

template<typename Scalar_>
template<EigenMatrixLike LHS>
VariableMatrix< Scalar > operator/ ( const LHS & lhs,
const Variable< Scalar > & rhs )
friend

Binary division operator.

Parameters
lhsOperator left-hand side.
rhsOperator right-hand side.
Returns
Result of division.

The documentation for this class was generated from the following file:
  • /home/runner/work/allwpilib/allwpilib/wpimath/src/main/native/thirdparty/sleipnir/include/sleipnir/autodiff/variable_matrix.hpp