blitz
Version 1.0.2
Toggle main menu visibility
Loading...
Searching...
No Matches
tvecglobs.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
/***************************************************************************
3
* blitz/tvecglobs.h TinyVector global functions
4
*
5
* $Id$
6
*
7
* Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
8
*
9
* This file is a part of Blitz.
10
*
11
* Blitz is free software: you can redistribute it and/or modify
12
* it under the terms of the GNU Lesser General Public License
13
* as published by the Free Software Foundation, either version 3
14
* of the License, or (at your option) any later version.
15
*
16
* Blitz is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Lesser General Public License for more details.
20
*
21
* You should have received a copy of the GNU Lesser General Public
22
* License along with Blitz. If not, see <http://www.gnu.org/licenses/>.
23
*
24
* Suggestions: blitz-devel@lists.sourceforge.net
25
* Bugs: blitz-support@lists.sourceforge.net
26
*
27
* For more information, please see the Blitz++ Home Page:
28
* https://sourceforge.net/projects/blitz/
29
*
30
***************************************************************************/
31
32
#ifndef BZ_TVECGLOBS_H
33
#define BZ_TVECGLOBS_H
34
35
#include <blitz/meta/metaprog.h>
36
#include <
blitz/numtrait.h
>
37
38
#include <
blitz/tvcross.h
>
// Cross products
39
#include <blitz/meta/dot.h>
40
#include <blitz/meta/product.h>
41
#include <blitz/meta/sum.h>
42
43
namespace
blitz
{
44
45
template
<
typename
T_numtype1,
typename
T_numtype2,
int
N_length>
46
inline
BZ_PROMOTE
(T_numtype1, T_numtype2)
47
dot(const
TinyVector
<T_numtype1, N_length>&
a
,
48
const
TinyVector
<T_numtype2, N_length>&
b
)
49
{
50
return
_bz_meta_vectorDot<N_length, 0>::f(
a
,
b
);
51
}
52
53
template
<
typename
T_numtype1,
int
N_length>
54
inline
BZ_SUMTYPE
(T_numtype1)
55
product(
const
TinyVector<T_numtype1, N_length>
&
a
)
56
{
57
return
_bz_meta_vectorProduct<N_length, 0>::f(
a
);
58
}
59
60
template
<
typename
T_numtype,
int
N_length>
61
inline
BZ_SUMTYPE
(T_numtype)
62
sum(
const
TinyVector<T_numtype, N_length>
&
a
)
63
{
64
return
_bz_meta_vectorSum<N_length, 0>::f(
a
);
65
}
66
67
// explicit returntype functions follow
68
69
template
<
typename
T_ret>
70
class
_bz_returntype
{
71
public
:
72
73
template
<
typename
T_numtype1,
typename
T_numtype2,
int
N_length>
74
static
inline
T_ret
75
dot
(
const
TinyVector<T_numtype1, N_length>
&
a
,
76
const
TinyVector<T_numtype2, N_length>
&
b
)
77
{
78
return
_bz_meta_vectorDotRet<N_length, 0, T_ret>::f(
a
,
b
);
79
};
80
81
template
<
typename
T_numtype1,
int
N_length>
82
static
inline
T_ret
83
product
(
const
TinyVector<T_numtype1, N_length>
&
a
)
84
{
85
return
_bz_meta_vectorProductRet<N_length, 0, T_ret>::f(
a
);
86
};
87
88
template
<
typename
T_numtype,
int
N_length>
89
static
inline
T_ret
90
sum
(
const
TinyVector<T_numtype, N_length>
&
a
)
91
{
92
return
_bz_meta_vectorSumRet<N_length, 0, T_ret>::f(
a
);
93
};
94
95
};
96
97
}
98
99
#endif
// BZ_TVECGLOBS_H
100
blitz::TinyVector
The TinyVector class is a one-dimensional, fixed length vector that implements the blitz expression t...
Definition
tinyvec2.h:73
blitz::_bz_returntype
Definition
tvecglobs.h:70
blitz::_bz_returntype::dot
static T_ret dot(const TinyVector< T_numtype1, N_length > &a, const TinyVector< T_numtype2, N_length > &b)
Definition
tvecglobs.h:75
blitz::_bz_returntype::sum
static T_ret sum(const TinyVector< T_numtype, N_length > &a)
Definition
tvecglobs.h:90
blitz::_bz_returntype::product
static T_ret product(const TinyVector< T_numtype1, N_length > &a)
Definition
tvecglobs.h:83
blitz
Definition
array-impl.h:66
blitz::b
N_length const TinyVector< T_numtype2, N_length > & b
Definition
tvecglobs.h:49
blitz::BZ_PROMOTE
BZ_PROMOTE(T_numtype1, T_numtype2) dot(const TinyVector< T_numtype1
blitz::a
N_length & a
Definition
tvecglobs.h:47
numtrait.h
BZ_SUMTYPE
#define BZ_SUMTYPE(X)
Definition
numtrait.h:42
tvcross.h
blitz
tvecglobs.h
Generated by
1.17.0