Flattened layout associated with an analytic function input domain.
More...
#include <codac2_analytic_flat_input_layout.h>
|
| | FlatInputLayout (const FunctionArgsList &args) |
| | Builds the flattened layout associated with a function argument list.
|
| Index | size () const |
| | Returns the total number of scalar inputs in the flattened domain.
|
| bool | same_domain_as (const FlatInputLayout &other) const |
| | Tests whether two layouts describe the same flattened input domain.
|
| bool | same_domain_as (const FunctionArgsList &other_args) const |
| | Tests whether this layout matches the flattened domain induced by a function argument list.
|
| Index | flat_index_of (const ScalarVar &x) const |
| | Returns the flat index associated with a scalar input variable.
|
| Index | flat_index_of (const VectorVar &x, Index i) const |
| | Returns the flat index associated with a direct component of a vector input variable.
|
| Index | flat_index_of (const MatrixVar &x, Index i, Index j) const |
| | Returns the flat index associated with a direct component of a matrix input variable.
|
| bool | flat_index_of (const ScalarExpr &x, Index &flat_index) const |
| | Tries to resolve a scalar input expression into a flat input index.
|
| const FlatInputBinding & | binding_of (const ExprID &id) const |
| | Returns the binding associated with an input expression identifier.
|
| const FlatInputBinding * | find_binding (const ExprID &id) const |
| | Returns the binding associated with an input expression identifier, if any.
|
Flattened layout associated with an analytic function input domain.
This class provides a canonical flattened representation of a function argument list. Each scalar, vector or matrix input argument is assigned a contiguous block of scalar indices.
◆ FlatInputLayout()
Builds the flattened layout associated with a function argument list.
- Parameters
-
| args | Function argument list. |
◆ size()
| Index codac2::FlatInputLayout::size |
( |
| ) |
const |
Returns the total number of scalar inputs in the flattened domain.
- Returns
- Flattened input domain size.
◆ same_domain_as() [1/2]
| bool codac2::FlatInputLayout::same_domain_as |
( |
const FlatInputLayout & | other | ) |
const |
Tests whether two layouts describe the same flattened input domain.
Here, only the total number of flattened scalar inputs matters.
- Parameters
-
| other | Other flattened layout. |
- Returns
- True if both layouts describe the same flattened input domain.
◆ same_domain_as() [2/2]
| bool codac2::FlatInputLayout::same_domain_as |
( |
const FunctionArgsList & | other_args | ) |
const |
Tests whether this layout matches the flattened domain induced by a function argument list.
- Parameters
-
| other_args | Function argument list. |
- Returns
- True if both domains are identical once flattened.
◆ flat_index_of() [1/4]
| Index codac2::FlatInputLayout::flat_index_of |
( |
const ScalarVar & | x | ) |
const |
Returns the flat index associated with a scalar input variable.
This method is restricted to scalar variables appearing directly in the function argument list.
- Parameters
-
- Returns
- Flat index associated with
x.
◆ flat_index_of() [2/4]
| Index codac2::FlatInputLayout::flat_index_of |
( |
const VectorVar & | x, |
|
|
Index | i ) const |
Returns the flat index associated with a direct component of a vector input variable.
- Parameters
-
| x | Vector input variable. |
| i | Component index. |
- Returns
- Flat index associated with
x[i].
◆ flat_index_of() [3/4]
| Index codac2::FlatInputLayout::flat_index_of |
( |
const MatrixVar & | x, |
|
|
Index | i, |
|
|
Index | j ) const |
Returns the flat index associated with a direct component of a matrix input variable.
- Parameters
-
| x | Matrix input variable. |
| i | Row index. |
| j | Column index. |
- Returns
- Flat index associated with
x(i,j).
◆ flat_index_of() [4/4]
| bool codac2::FlatInputLayout::flat_index_of |
( |
const ScalarExpr & | x, |
|
|
Index & | flat_index ) const |
Tries to resolve a scalar input expression into a flat input index.
Supported expressions are:
- a scalar input variable;
- a direct component of a vector input variable;
- a direct component of a matrix input variable.
- Parameters
-
| x | Scalar input expression. |
| flat_index | Output flat input index. |
- Returns
- True if
x could be resolved into a flat input index.
◆ binding_of()
Returns the binding associated with an input expression identifier.
- Parameters
-
| id | Input expression identifier. |
- Returns
- Binding associated with
id.
◆ find_binding()
Returns the binding associated with an input expression identifier, if any.
- Parameters
-
| id | Input expression identifier. |
- Returns
- Pointer to the associated binding, or nullptr if
id does not belong to the layout.
The documentation for this class was generated from the following file: