|
Janus 2.0.0
High-performance C++20 dual-mode numerical framework
|
Smooth surrogate functions (softmax, softmin, softplus, sigmoid, blend, KS aggregation). More...
#include "janus/core/JanusConcepts.hpp"#include "janus/core/JanusError.hpp"#include "janus/math/Arithmetic.hpp"#include "janus/math/Logic.hpp"#include "janus/math/Trig.hpp"#include <Eigen/Dense>#include <cmath>#include <numeric>#include <string>#include <vector>

Go to the source code of this file.
Namespaces | |
| namespace | janus |
| namespace | janus::detail |
| Smooth approximation of ReLU function: softplus(x) = (1/beta) * log(1 + exp(beta * x)). | |
Enumerations | |
| enum class | janus::SigmoidType { janus::Tanh , janus::Logistic , janus::Arctan , janus::Polynomial } |
| Sigmoid shape selection. More... | |
Functions | |
| template<typename T> | |
| auto | janus::softmax (const std::vector< T > &args, double softness=1.0) |
| Computes the smooth maximum (LogSumExp) of a collection of values. | |
| template<typename T1, typename T2> | |
| auto | janus::softmax (const T1 &a, const T2 &b, double softness=1.0) |
| template<typename T> | |
| auto | janus::softmin (const std::vector< T > &args, double softness=1.0) |
| Computes the smooth minimum of a collection of values. softmin(x) = -softmax(-x). | |
| template<typename T1, typename T2> | |
| auto | janus::softmin (const T1 &a, const T2 &b, double softness=1.0) |
| void | janus::detail::validate_hardness (double hardness, const char *function_name) |
| void | janus::detail::validate_rho (double rho) |
| template<std::floating_point T> | |
| auto | janus::detail::softplus_scalar (const T &x, double beta) |
| auto | janus::detail::softplus_scalar (const SymbolicScalar &x, double beta) |
| template<JanusScalar T> | |
| auto | janus::softplus (const T &x, double beta=1.0, double=20.0) |
| template<typename Derived> | |
| auto | janus::softplus (const Eigen::MatrixBase< Derived > &x, double beta=1.0, double threshold=20.0) |
| template<typename T> | |
| auto | janus::smooth_abs (const T &x, double hardness=1.0) |
| Smooth approximation of absolute value. | |
| template<typename T1, typename T2> | |
| auto | janus::smooth_max (const T1 &a, const T2 &b, double hardness=1.0) |
| Pairwise smooth maximum. | |
| template<typename T1, typename T2> | |
| auto | janus::smooth_min (const T1 &a, const T2 &b, double hardness=1.0) |
| Pairwise smooth minimum. | |
| template<typename TX, typename TLow, typename THigh> | |
| auto | janus::smooth_clamp (const TX &x, const TLow &low, const THigh &high, double hardness=1.0) |
| Smooth approximation of clamp(x, low, high). | |
| template<JanusScalar T> | |
| auto | janus::ks_max (const std::vector< T > &values, double rho=1.0) |
| Kreisselmeier-Steinhauser smooth maximum aggregator. | |
| template<typename Derived> | |
| auto | janus::ks_max (const Eigen::MatrixBase< Derived > &values, double rho=1.0) |
| template<typename T> | |
| auto | janus::sigmoid (const T &x, SigmoidType type=SigmoidType::Tanh, double norm_min=0.0, double norm_max=1.0) |
| Sigmoid function with normalization capability. | |
| template<typename T> | |
| auto | janus::swish (const T &x, double beta=1.0) |
| Swish activation function: x / (1 + exp(-beta * x)). | |
| template<typename TSwitch, typename THigh, typename TLow> | |
| auto | janus::blend (const TSwitch &switch_val, const THigh &val_high, const TLow &val_low) |
| Smoothly blends between two values based on a switch parameter. | |
Smooth surrogate functions (softmax, softmin, softplus, sigmoid, blend, KS aggregation).