imate
C++/CUDA Reference
SmoothStep Class Reference

Defines the function. More...

#include <smoothstep.h>

Inheritance diagram for SmoothStep:
Collaboration diagram for SmoothStep:

Public Member Functions

 SmoothStep (double alpha_)
 Sets the default for the parameter alpha to 1.0. More...
 
virtual float function (const float lambda_) const
 
virtual double function (const double lambda_) const
 
virtual long double function (const long double lambda_) const
 
- Public Member Functions inherited from Function
virtual ~Function ()
 Default virtual destructor. More...
 

Public Attributes

double alpha
 

Detailed Description

Defines the function.

\[ f: \lambda \mapsto \frac{1}{2} \left( 1 + \mathrm{tanh}(\alpha \lambda) \right) \]

where \( \alpha \) is a scale parameter and should be set by this->alpha member.

The matrix function \( f: \mathbb{R}^{n \times n} \to \mathbb{R}^{n \times n} \) is used in

\[ \mathrm{trace} \left( f(\mathbf{A}) \right). \]

However, instead of a matrix function, the equivalent scalar function \( f: \mathbb{R} \to \mathbb{R} \) is defiend which acts on the eigenvalues of the matrix.

Note
The smooth step function defined here should not be confused with a conventionally used function of the same name using cubic polynomial.

Definition at line 50 of file smoothstep.h.

Constructor & Destructor Documentation

◆ SmoothStep()

SmoothStep::SmoothStep ( double  alpha_)

Sets the default for the parameter alpha to 1.0.

Definition at line 27 of file smoothstep.cpp.

28 {
29  this->alpha = alpha_;
30 }
double alpha
Definition: smoothstep.h:57

References alpha.

Member Function Documentation

◆ function() [1/3]

double SmoothStep::function ( const double  lambda_) const
virtual
Parameters
[in]lambda_Eigenvalue (or singular value) of matrix.
Returns
The value of matrix function for the given eigenvalue.

Implements Function.

Definition at line 55 of file smoothstep.cpp.

56 {
57  return 0.5 * (1.0 + tanh(this->alpha * lambda_));
58 }

References alpha.

◆ function() [2/3]

float SmoothStep::function ( const float  lambda_) const
virtual
Parameters
[in]lambda_Eigenvalue (or singular value) of matrix.
Returns
The value of matrix function for the given eigenvalue.

Implements Function.

Definition at line 41 of file smoothstep.cpp.

42 {
43  return 0.5 * (1.0 + tanh(static_cast<float>(this->alpha) * lambda_));
44 }

References alpha.

◆ function() [3/3]

long double SmoothStep::function ( const long double  lambda_) const
virtual
Parameters
[in]lambda_Eigenvalue (or singular value) of matrix.
Returns
The value of matrix function for the given eigenvalue.

Implements Function.

Definition at line 69 of file smoothstep.cpp.

70 {
71  return 0.5 * (1.0 + tanh(static_cast<long double>(this->alpha) * lambda_));
72 }

References alpha.

Member Data Documentation

◆ alpha

double SmoothStep::alpha

Definition at line 57 of file smoothstep.h.

Referenced by function(), and SmoothStep().


The documentation for this class was generated from the following files: