Program Listing for File LogDerivatives.h

Return to documentation for file (/home/kpenev/projects/git/poet/poet_src/Core/LogDerivatives.h)

#ifndef __LOG_ARG_DERIVATIVES_H
#define __LOG_ARG_DERIVATIVES_H

#include "../Core/SharedLibraryExportMacros.h"
#include "Functions.h"
#include "Error.h"
#include <vector>

namespace StellarEvolution {

    using Core::FunctionDerivatives;
    using Core::NaN;

    class LIB_LOCAL LogDerivatives : public FunctionDerivatives {
    private:
        double __x;

        bool
            __log_x,

            __log_y;

        mutable std::vector<double>
            __underlying_deriv_values,

            __deriv_values;

        double transform_log_x_deriv(unsigned order) const;

        double transform_log_y_deriv(
            double uncorrected_derivative,

            unsigned order
        ) const;

    protected:
        virtual double calc_deriv(unsigned deriv_order) const =0;
    public:
        LogDerivatives(
            double x = NaN,

            bool log_y = false
        ) : __x(x), __log_x(!std::isnan(x)), __log_y(log_y) {}

        double order(unsigned deriv_order=1) const;
    }; //End of LogDerivatives class

} //End of StellarEvolution namespace.

#endif