numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::auto_diff::backward::variable< Scalar > Class Template Reference

Class of variables in backward-mode automatic differentiation [17]. More...

#include <num_collect/auto_diff/backward/variable.h>

+ Collaboration diagram for num_collect::auto_diff::backward::variable< Scalar >:

Public Types

using scalar_type = Scalar
 Type of scalars.
 

Public Member Functions

 variable ()
 Constructor.
 
 variable (const scalar_type &value)
 Construct constants.
 
 variable (const scalar_type &value, const constant_tag &)
 Construct constants.
 
 variable (const scalar_type &value, const variable_tag &)
 Construct variables.
 
 variable (const scalar_type &value, graph::node_ptr< scalar_type > node)
 Constructor.
 
auto node () const noexcept -> const graph::node_ptr< scalar_type > &
 Get the node.
 
auto operator*= (const variable &right) -> variable &
 Multiply this variable by a variable.
 
auto operator+= (const variable &right) -> variable &
 Add a variable to this variable.
 
auto operator- () const -> variable
 Negate this variable.
 
auto operator-= (const variable &right) -> variable &
 Subtract a variable from this variable.
 
auto operator/= (const variable &right) -> variable &
 Divide this variable by a variable.
 
auto value () const noexcept -> const scalar_type &
 Get the value.
 

Private Attributes

graph::node_ptr< scalar_typenode_
 Node.
 
scalar_type value_
 Value.
 

Detailed Description

template<base::concepts::real_scalar Scalar>
class num_collect::auto_diff::backward::variable< Scalar >

Class of variables in backward-mode automatic differentiation [17].

Template Parameters
ScalarType of scalars.

Definition at line 48 of file variable.h.

Member Typedef Documentation

◆ scalar_type

template<base::concepts::real_scalar Scalar>
using num_collect::auto_diff::backward::variable< Scalar >::scalar_type = Scalar

Type of scalars.

Definition at line 51 of file variable.h.

Constructor & Destructor Documentation

◆ variable() [1/5]

template<base::concepts::real_scalar Scalar>
num_collect::auto_diff::backward::variable< Scalar >::variable ( const scalar_type & value,
graph::node_ptr< scalar_type > node )
inline

Constructor.

Parameters
[in]valueValue.
[in]nodeNode.

Definition at line 59 of file variable.h.

◆ variable() [2/5]

template<base::concepts::real_scalar Scalar>
num_collect::auto_diff::backward::variable< Scalar >::variable ( const scalar_type & value,
const constant_tag &  )
inline

Construct constants.

Parameters
[in]valueValue.

Definition at line 67 of file variable.h.

◆ variable() [3/5]

template<base::concepts::real_scalar Scalar>
num_collect::auto_diff::backward::variable< Scalar >::variable ( const scalar_type & value,
const variable_tag &  )
inline

Construct variables.

Parameters
[in]valueValue.

Definition at line 75 of file variable.h.

◆ variable() [4/5]

template<base::concepts::real_scalar Scalar>
num_collect::auto_diff::backward::variable< Scalar >::variable ( const scalar_type & value)
inline

Construct constants.

Parameters
[in]valueValue.

Definition at line 83 of file variable.h.

◆ variable() [5/5]

template<base::concepts::real_scalar Scalar>
num_collect::auto_diff::backward::variable< Scalar >::variable ( )
inline

Constructor.

Definition at line 89 of file variable.h.

Member Function Documentation

◆ node()

template<base::concepts::real_scalar Scalar>
auto num_collect::auto_diff::backward::variable< Scalar >::node ( ) const -> const graph::node_ptr<scalar_type>&
inlinenodiscardnoexcept

Get the node.

Returns
Node.

Definition at line 105 of file variable.h.

◆ operator*=()

template<base::concepts::real_scalar Scalar>
auto num_collect::auto_diff::backward::variable< Scalar >::operator*= ( const variable< Scalar > & right) -> variable&
inline

Multiply this variable by a variable.

Parameters
[in]rightRight-hand-side variable.
Returns
This.

Definition at line 184 of file variable.h.

◆ operator+=()

template<base::concepts::real_scalar Scalar>
auto num_collect::auto_diff::backward::variable< Scalar >::operator+= ( const variable< Scalar > & right) -> variable&
inline

Add a variable to this variable.

Parameters
[in]rightRight-hand-side variable.
Returns
This.

Definition at line 130 of file variable.h.

◆ operator-()

template<base::concepts::real_scalar Scalar>
auto num_collect::auto_diff::backward::variable< Scalar >::operator- ( ) const -> variable
inline

Negate this variable.

Returns
Negative variable.

Definition at line 115 of file variable.h.

◆ operator-=()

template<base::concepts::real_scalar Scalar>
auto num_collect::auto_diff::backward::variable< Scalar >::operator-= ( const variable< Scalar > & right) -> variable&
inline

Subtract a variable from this variable.

Parameters
[in]rightRight-hand-side variable.
Returns
This.

Definition at line 156 of file variable.h.

◆ operator/=()

template<base::concepts::real_scalar Scalar>
auto num_collect::auto_diff::backward::variable< Scalar >::operator/= ( const variable< Scalar > & right) -> variable&
inline

Divide this variable by a variable.

Parameters
[in]rightRight-hand-side variable.
Returns
This.

Definition at line 213 of file variable.h.

◆ value()

template<base::concepts::real_scalar Scalar>
auto num_collect::auto_diff::backward::variable< Scalar >::value ( ) const -> const scalar_type&
inlinenodiscardnoexcept

Get the value.

Returns
Value.

Definition at line 96 of file variable.h.

Member Data Documentation

◆ node_

template<base::concepts::real_scalar Scalar>
graph::node_ptr<scalar_type> num_collect::auto_diff::backward::variable< Scalar >::node_
private

Node.

Definition at line 243 of file variable.h.

◆ value_

template<base::concepts::real_scalar Scalar>
scalar_type num_collect::auto_diff::backward::variable< Scalar >::value_
private

Value.

Definition at line 240 of file variable.h.


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