cheshirekow
v0.1.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
scale.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 fiber.
5
*
6
* fiber 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
* fiber 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 fiber. If not, see <http://www.gnu.org/licenses/>.
18
*/
25
#ifndef FIBER_SCALE_H_
26
#define FIBER_SCALE_H_
27
28
29
namespace
fiber {
30
31
template
<
typename
Scalar,
class
Exp>
32
class
_Scale
:
public
_RValue
<Scalar, _Scale<Scalar, Exp> > {
33
Scalar
s_
;
34
Exp
const
&
M_
;
35
36
public
:
37
enum
{
38
ROWS_
= Exp::ROWS_,
39
COLS_
= Exp::COLS_,
40
SIZE_
= Exp::SIZE_
41
};
42
43
_Scale
(Scalar
s
, Exp
const
& A) :
s_
(s),
M_
(A) {}
44
45
Size
size
()
const
{
return
M_
.size(); }
46
Size
rows
()
const
{
return
M_
.rows(); }
47
Size
cols
()
const
{
return
M_
.cols(); }
48
49
Scalar
operator[]
(
Size
i)
const
{
return
s_
*
M_
[i]; }
50
Scalar
operator()
(
Size
i,
Size
j)
const
{
return
s_
*
M_
(i, j); }
51
};
52
53
template
<
typename
Scalar,
class
Exp>
54
inline
_Scale<Scalar, Exp>
operator*
(Scalar
s
,
_RValue<Scalar, Exp>
const
& A) {
55
return
_Scale<Scalar, Exp>
(
s
,
static_cast<
Exp const&
>
(A));
56
}
57
58
template
<
typename
Scalar,
class
Exp>
59
inline
_Scale<Scalar, Exp>
operator*
(
_RValue<Scalar, Exp>
const
& A, Scalar
s
) {
60
return
_Scale<Scalar, Exp>
(
s
,
static_cast<
Exp const&
>
(A));
61
}
62
63
}
// namespace fiber
64
65
66
#endif // FIBER_SCALE_H_
fiber::_Scale::operator()
Scalar operator()(Size i, Size j) const
Definition:
scale.h:50
fiber::_RValue
expression template for rvalues
Definition:
rvalue.h:33
fiber::_Scale::size
Size size() const
Definition:
scale.h:45
fiber::_Scale
Definition:
scale.h:32
fiber::_Scale::rows
Size rows() const
Definition:
scale.h:46
fiber::Size
unsigned int Size
Definition:
fiber.h:32
fiber::_Scale::_Scale
_Scale(Scalar s, Exp const &A)
Definition:
scale.h:43
fiber::_Scale::s_
Scalar s_
Definition:
scale.h:33
fiber::_Scale::M_
Exp const & M_
Definition:
scale.h:34
mpblocks::cuda::polynomial::param_key::s
const ParamKey s
Definition:
Construct.h:38
fiber::_Scale::COLS_
Definition:
scale.h:39
fiber::_Scale::SIZE_
Definition:
scale.h:40
fiber::_Scale::operator[]
Scalar operator[](Size i) const
Definition:
scale.h:49
fiber::operator*
Matrix< Scalar, Exp1::ROWS_, Exp2::COLS_ > operator*(_RValue< Scalar, Exp1 > const &A, _RValue< Scalar, Exp2 > const &B)
Matrix multiplication.
Definition:
product.h:34
fiber::_Scale::ROWS_
Definition:
scale.h:38
fiber::_Scale::cols
Size cols() const
Definition:
scale.h:47
include
fiber
scale.h
Generated on Sun Mar 22 2015 22:47:43 for cheshirekow by
1.8.6