Program Listing for File sigmoid.hpp

Return to documentation for file (rcppsw/math/sigmoid.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include "rcppsw/math/config/sigmoid_config.hpp"
#include "rcppsw/math/expression.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace rcppsw::math {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/

class sigmoid : public expression<double> {
 public:
  sigmoid(void) = default;

  explicit sigmoid(const config::sigmoid_config* const config)
      : sigmoid{ config->reactivity, config->offset, config->gamma } {}

  sigmoid(double reactivity, double offset, double gamma)
      : m_reactivity(reactivity), m_offset(offset), m_gamma(gamma) {}

  void init(double reactivity, double offset, double gamma) {
    m_reactivity = reactivity;
    m_offset = offset;
    m_gamma = gamma;
  }

 protected:
  double reactivity(void) const { return m_reactivity; }
  double offset(void) const { return m_offset; }
  double gamma(void) const { return m_gamma; }

 private:
  /* clang-format off */
  double m_reactivity{0.0};
  double m_offset{0.0};
  double m_gamma{0.0};
  /* clang-format on */
};

} /* namespace rcppsw::math */