cheshirekow
v0.1.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Negative.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
3
*
4
* This file is part of mpblocks.
5
*
6
* mpblocks is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* mpblocks is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with mpblocks. If not, see <http://www.gnu.org/licenses/>.
18
*/
27
#ifndef MPBLOCKS_CUDA_POLYNOMIAL_NEGATIVE_H_
28
#define MPBLOCKS_CUDA_POLYNOMIAL_NEGATIVE_H_
29
30
namespace
mpblocks {
31
namespace
cuda {
32
namespace
polynomial {
33
35
template
<
typename
Scalar,
class
Exp,
class
Spec>
36
struct
Negative
:
37
public
RValue
< Scalar,Negative<Scalar,Exp,Spec>,Spec >
38
{
39
Exp
const
&
exp
;
40
41
__host__
__device__
42
Negative
( Exp
const
&
exp
):
43
exp(exp)
44
{}
45
46
__host__
__device__
47
Scalar
eval
( Scalar
x
)
48
{
49
return
-
exp
.eval(x);
50
}
51
};
52
53
template
<
typename
Scalar,
class
Exp,
class
Spec>
54
struct
get_spec
<
Negative
<Scalar,Exp,Spec > >
55
{
56
typedef
Spec
result
;
57
};
58
59
template
<
int
id
x,
typename
Scalar,
class
Exp,
class
Spec>
60
__host__
__device__
61
Scalar
get
(
const
Negative<Scalar,Exp,Spec>
& exp )
62
{
63
return
-get<idx>( exp.exp );
64
}
65
66
67
template
<
typename
Scalar,
class
Exp,
class
Spec>
68
__host__
__device__
69
Negative<Scalar,Exp,Spec>
operator-
(
70
RValue<Scalar,Exp,Spec>
const
& exp )
71
{
72
return
Negative<Scalar,Exp,Spec>
(
static_cast<
Exp const&
>
(exp) );
73
}
74
75
76
77
78
}
// polynomial
79
}
// cuda
80
}
// mpblocks
81
82
83
84
85
86
#endif // NEGATIVE_H_
mpblocks::cuda::polynomial::Negative
expression template for sum of two matrix expressions
Definition:
Negative.h:36
mpblocks::cuda::polynomial::get_spec< Negative< Scalar, Exp, Spec > >::result
Spec result
Definition:
Negative.h:56
mpblocks::cuda::polynomial::Negative::exp
Exp const & exp
Definition:
Negative.h:39
mpblocks::cuda::polynomial::RValue
expression template for rvalues
Definition:
RValue.h:40
mpblocks::cuda::polynomial::param_key::x
const ParamKey x
Definition:
Construct.h:39
mpblocks::cuda::polynomial::operator-
__host__ __device__ Difference< Scalar, Exp1, Spec1, Exp2, Spec2 > operator-(RValue< Scalar, Exp1, Spec1 > const &A, RValue< Scalar, Exp2, Spec2 > const &B)
Definition:
Difference.h:84
__device__
#define __device__
Definition:
fakecuda.h:34
__host__
#define __host__
Definition:
fakecuda.h:37
mpblocks::cuda::polynomial::Negative::Negative
__host__ __device__ Negative(Exp const &exp)
Definition:
Negative.h:42
mpblocks::cuda::polynomial::get_spec
Definition:
get_spec.h:35
mpblocks::cuda::polynomial::Negative::eval
__host__ __device__ Scalar eval(Scalar x)
Definition:
Negative.h:47
include
mpblocks
cuda
polynomial
Negative.h
Generated on Sun Mar 22 2015 22:47:44 for cheshirekow by
1.8.6