imate
C++/CUDA Reference
exponential.cpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu>
3  * SPDX-License-Identifier: BSD-3-Clause
4  * SPDX-FileType: SOURCE
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the license found in the LICENSE.txt file in the root
8  * directory of this source tree.
9  */
10 
11 
12 // =======
13 // Headers
14 // =======
15 
16 #include <cmath> // exp
17 #include "./exponential.h"
18 
19 
20 // ===========
21 // Exponential
22 // ===========
23 
26 
28 {
29  this->coeff = coeff_;
30 }
31 
32 
33 // ====================
34 // Exponential function (float)
35 // ====================
36 
40 
41 float Exponential::function(const float lambda_) const
42 {
43  return exp(lambda_ * static_cast<float>(this->coeff));
44 }
45 
46 
47 // ====================
48 // Exponential function (double)
49 // ====================
50 
54 
55 double Exponential::function(const double lambda_) const
56 {
57  return exp(lambda_ * static_cast<double>(this->coeff));
58 }
59 
60 
61 // ====================
62 // Exponential function (long double)
63 // ====================
64 
68 
69 long double Exponential::function(const long double lambda_) const
70 {
71  return exp(lambda_ * static_cast<long double>(this->coeff));
72 }
Exponential(double coeff_)
Sets the default for the parameter coeff to 1.0.
Definition: exponential.cpp:27
virtual float function(const float lambda_) const
Definition: exponential.cpp:41
double coeff
Definition: exponential.h:47