Prev Next atomic_four_vector_rev_depend.hpp

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@This is cppad-20221105 documentation. Here is a link to its current documentation .
Atomic Vector Forward Type Calculation: Example Implementation

Purpose
The rev_depend routine overrides the virtual functions used by the atomic_four base class for Jacobian sparsity calculations; see rev_depend .

Example
The file atomic_four_vector_rev_depend.cpp contains an example and test that uses this member function.

Source

# include <cppad/example/atomic_four/vector/vector.hpp>

namespace CppAD { // BEGIN_CPPAD_NAMESPACE
//
// rev_depend override
template <class Base>
bool atomic_vector<Base>::rev_depend(
    size_t                         call_id     ,
    CppAD::vector<bool>&           depend_x    ,
    const CppAD::vector<bool>&     depend_y    )
{
    // n, m
    size_t n     = depend_x.size();
    size_t m     = depend_y.size();
    //
    // type_y
    if( n == m  )
    {   // unary operator
        for(size_t i = 0; i < m; ++i)
            depend_x[i] = depend_y[i];
    }
    else
    {   // binary operator
        for(size_t i = 0; i < m; ++i)
        {   depend_x[i]     = depend_y[i];
            depend_x[m + i] = depend_y[i];
        }
    }
    return true;
}
} // END_CPPAD_NAMESPACE

Input File: include/cppad/example/atomic_four/vector/rev_depend.hpp