<commit_before>/*
 * This is part of the FL library, a C++ Bayesian filtering library
 * (https://github.com/filtering-library)
 *
 * Copyright (c) 2014 <NAME> (<EMAIL>)
 * Copyright (c) 2014 <NAME> (<EMAIL>)
 *
 * Max-Planck Institute for Intelligent Systems, AMD Lab
 * University of Southern California, CLMC Lab
 *
 * This Source Code Form is subject to the terms of the MIT License (MIT).
 * A copy of the license can be found in the LICENSE file distributed with this
 * source code.
 */

/**
 * \file general_functions.hpp
 * \date January 2015
 * \author <NAME> (<EMAIL>)
 * \author <NAME> (<EMAIL>)
 */

#ifndef FL__UTIL__MATH__GENERAL_FUNCTIONS_HPP
#define FL__UTIL__MATH__GENERAL_FUNCTIONS_HPP

#include <cmath>
#include <fl/util/types.hpp>

namespace fl
{

/**
 * \brief Sigmoid function
 * \ingroup general_functions
 */
constexpr FloatingPoint sigmoid(const FloatingPoint& x)
{
    return 1.0 / (1.0 + std::exp(-x));
}

/**
 * \brief log odd
 * \ingroup general_functions
 */
constexpr FloatingPoint logit(const FloatingPoint& x)
{
    return std::log(x / (1.0 - x));
}


constexpr long timesteps(FloatingPoint discretization_time_step,
                        FloatingPoint delta_time)
{
    return std::round(delta_time/discretization_time_step);
}

}

#endif<commit_msg>FloatingPoint > Real, added timesteps constexpr implementation<commit_after>/*
 * This is part of the FL library, a C++ Bayesian filtering library
 * (https://github.com/filtering-library)
 *
 * Copyright (c) 2014 <NAME> (<EMAIL>)
 * Copyright (c) 2014 <NAME> (<EMAIL>)
 *
 * Max-Planck Institute for Intelligent Systems, AMD Lab
 * University of Southern California, CLMC Lab
 *
 * This Source Code Form is subject to the terms of the MIT License (MIT).
 * A copy of the license can be found in the LICENSE file distributed with this
 * source code.
 */

/**
 * \file general_functions.hpp
 * \date January 2015
 * \author <NAME> (<EMAIL>)
 * \author <NAME> (<EMAIL>)
 */

#ifndef FL__UTIL__MATH__GENERAL_FUNCTIONS_HPP
#define FL__UTIL__MATH__GENERAL_FUNCTIONS_HPP

#include <cmath>
#include <fl/util/types.hpp>

namespace fl
{

/**
 * \brief Sigmoid function
 * \ingroup general_functions
 */
constexpr Real sigmoid(const Real& x)
{
    return 1.0 / (1.0 + std::exp(-x));
}

/**
 * \brief log odd
 * \ingroup general_functions
 */
constexpr Real logit(const Real& x)
{
    return std::log(x / (1.0 - x));
}

long timesteps(Real discretization_time_step,
               Real delta_time)
{
    return std::round(delta_time/discretization_time_step);

//    // constexpr return function version
//    return (delta_time/discretization_time_step) -
//           - int(delta_time/discretization_time_step) > 0.5 ?
//           int(delta_time/discretization_time_step) + 1 :
//           int(delta_time/discretization_time_step);
}

}

#endif
{'fraction_non_alphanumeric': 0.12106194690265487, 'fraction_numerical': 0.013805309734513275, 'mean_word_length': 3.5951219512195123, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3942555', 'n_tokens_mistral': 971, 'n_tokens_neox': 921, 'n_words': 266}