imate
C++/CUDA Reference
power.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>
// pow
17
#include "
./power.h
"
18
19
20
// =====
21
// Power
22
// =====
23
26
27
Power::Power
():
28
exponent(2.0)
29
{
30
}
31
32
33
// ==============
34
// Power function (float)
35
// ==============
36
40
41
float
Power::function
(
const
float
lambda_)
const
42
{
43
return
pow(lambda_,
static_cast<
float
>
(this->
exponent
));
44
}
45
46
47
// ==============
48
// Power function (double)
49
// ==============
50
54
55
double
Power::function
(
const
double
lambda_)
const
56
{
57
return
pow(lambda_, this->
exponent
);
58
}
59
60
61
// ==============
62
// Power function (long double)
63
// ==============
64
68
69
long
double
Power::function
(
const
long
double
lambda_)
const
70
{
71
return
pow(lambda_,
static_cast<
long
double
>
(this->
exponent
));
72
}
Power::Power
Power()
Sets the default for the parameter exponent to 2.0.
Definition:
power.cpp:27
Power::exponent
double exponent
Definition:
power.h:49
Power::function
virtual float function(const float lambda_) const
Definition:
power.cpp:41
power.h
imate
functions
power.cpp
Generated on Mon Jan 22 2024 00:04:58 for imate by
1.9.1