Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
DerivativesMutableXpr Class Referencefinal

Detailed Description

The return type for AutoDiff::derivatives() when the AutoDiff is mutable.

The underlying type is Eigen::Map<Eigen::VectorXd> which includes all of the usual functions for element access and arithmetic.

Note
Unlike a typical Map, this class also provides the capability to resize() the underlying data as well as assign through from a vector of different size.
Warning
After resizing or assigning to this object, this is no longer valid. Always use those functions' return value as the ongoing means of access.

#include <drake/common/ad/internal/derivatives_xpr.h>

Public Member Functions

 DerivativesMutableXpr (const DerivativesMutableXpr &)=default
 This class is copyable and copy-assignable.
DerivativesMutableXpr operator= (const DerivativesMutableXpr &other)
template<typename Derived>
DerivativesMutableXpr operator= (const DenseBase< Derived > &other)
 Sets the AutoDiff::derivatives() to a new value and returns a new Xpr.
DerivativesMutableXpr resize (Eigen::Index rows, Eigen::Index cols=1)
 Like MatrixBase::resize(), discards any existing data and resizes the derivatives vector.
DerivativesMutableXpr conservativeResize (Eigen::Index rows, Eigen::Index cols=1)
 Like MatrixBase::conservativeResize(), changes the size() of this while keeping existing data intact.

Constructor & Destructor Documentation

◆ DerivativesMutableXpr()

DerivativesMutableXpr ( const DerivativesMutableXpr & )
default

This class is copyable and copy-assignable.

Member Function Documentation

◆ conservativeResize()

DerivativesMutableXpr conservativeResize ( Eigen::Index rows,
Eigen::Index cols = 1 )

Like MatrixBase::conservativeResize(), changes the size() of this while keeping existing data intact.

New values are filled with zeros.

Note
The signature and defaults match MatrixBase::conservativeResize().
Warning
After calling this object, this is no longer valid. Always use the return value as the ongoing means of access.
Precondition
rows >= 0
Exceptions
std::exceptionwhen cols != 1

◆ operator=() [1/2]

template<typename Derived>
DerivativesMutableXpr operator= ( const DenseBase< Derived > & other)

Sets the AutoDiff::derivatives() to a new value and returns a new Xpr.

Warning
After calling this object, this is no longer valid. Always use the return value as the ongoing means of access, or call AutoDiff::derivatives() again to obtain a new reference.

◆ operator=() [2/2]

DerivativesMutableXpr operator= ( const DerivativesMutableXpr & other)

◆ resize()

DerivativesMutableXpr resize ( Eigen::Index rows,
Eigen::Index cols = 1 )

Like MatrixBase::resize(), discards any existing data and resizes the derivatives vector.

Note
The signature and defaults match MatrixBase::resize().
Warning
After calling this object, this is no longer valid. Always use the return value as the ongoing means of access.
Precondition
rows >= 0
Exceptions
std::exceptionwhen cols != 1

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