#ifndef _ADV_TAPE_HPP #define _ADV_TAPE_HPP #include "Context.hpp" #include namespace adv { // Forward decls struct AbsNormalForm; /// \brief Sequence of recorded operation representing an arithmetic graph class Tape final { public: /// \brief Destructor. ~Tape(); /// \brief Default constructor. Tape() = delete; /// \brief Copy constructor. Tape(const Tape&) = delete; /// \brief Move constructor. Tape(Tape&&); /// \brief Construct a tape from a context Tape(Context&& ctx); /// \brief Copy assignment. Tape& operator=(const Tape&) = delete; /// \brief Move assignment. Tape& operator=(Tape&&); /// \brief Number of independent vars. std::size_t num_indeps() const; /// \brief Number of dependent vars. std::size_t num_deps() const; /// \brief Number of abs evaluations. std::size_t num_abs() const; /// Decompose an abs-factorable function Tape abs_decompose() const; private: struct Impl; Impl* m_impl; Tape(void*); const void* get_impl() const; friend std::vector zero_order(const Tape&, const std::vector&); friend std::pair, std::vector> first_order(const Tape& tape, const std::vector& x, const std::vector& dx); friend std::pair, std::vector> first_order_reverse(const Tape& tape, const std::vector& x_, const std::vector& ybar_); friend std::vector jacobian(const Tape& tape, const std::vector& x); friend std::vector jacobian_reverse(const Tape& tape, const std::vector& x); friend AbsNormalForm abs_normal(const Tape& tape, const std::vector& x); }; } #endif // _ADV_TAPE_HPP