// This file is part of Bertini 2. // // jacobian.hpp is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or //(at your option) any later version. // // jacobian.hpp is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with jacobian.hpp. If not, see . // // Copyright(C) 2015 - 2021 by Bertini2 Development Team // // See for a copy of the license, // as well as COPYING. Bertini2 is provided with permitted // additional terms in the b2/licenses/ directory. // individual authors of this file include: // James Collins // West Texas A&M University // Spring, Summer 2015 // // silviana amethyst, university of wisconsin-eau claire // // silviana amethyst // UWEC // Spring 2018 // // Created by Collins, James B. on 6/11/15. // // // jacobian.hpp: Declares the class Jacobian. /** \file jacobian.hpp \brief Provides the Jacobian node type. */ #ifndef BERTINI_JACOBIAN_NODE_HPP #define BERTINI_JACOBIAN_NODE_HPP #include "function_tree/node.hpp" #include "function_tree/roots/function.hpp" #include "function_tree/symbols/variable.hpp" namespace bertini { namespace node { /** \brief Defines the entry point into a Jacobian tree. This class defines a Jacobian tree. It stores the entry node for a particular functions tree. */ class Jacobian : public virtual Handle, public virtual EnableSharedFromThisVirtual { friend detail::FreshEvalSelector; friend detail::FreshEvalSelector; public: BERTINI_DEFAULT_VISITABLE() template static std::shared_ptr Make(Ts&&... ts) { return std::shared_ptr(new Jacobian(ts...)); } private: /** */ Jacobian(const std::shared_ptr& entry); public: /** Jacobians must be evaluated with EvalJ, so that when current_diff_variable changes the Jacobian is reevaluated. */ template T Eval(std::shared_ptr const& diff_variable = nullptr) const = delete; // Evaluate the node. If flag false, just return value, if flag true // run the specific FreshEval of the node, then set flag to false. template T EvalJ(std::shared_ptr const& diff_variable) const; // Evaluate the node. If flag false, just return value, if flag true // run the specific FreshEval of the node, then set flag to false. template void EvalJInPlace(T& eval_value, std::shared_ptr const& diff_variable) const; virtual ~Jacobian() = default; /** \brief Default construction of a Jacobian node is forbidden */ Jacobian() = default; private: mutable std::shared_ptr current_diff_variable_; friend class boost::serialization::access; template void serialize(Archive& ar, const unsigned version) { ar& boost::serialization::base_object(*this); } }; } // namespace node } // namespace bertini #endif