]> Dogcows Code - chaz/yoink/blob - src/moof/cml/matvec/matvec_promotions.h
fixes for newer versions of g++
[chaz/yoink] / src / moof / cml / matvec / matvec_promotions.h
1 /* -*- C++ -*- ------------------------------------------------------------
2
3 Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/
4
5 The Configurable Math Library (CML) is distributed under the terms of the
6 Boost Software License, v1.0 (see cml/LICENSE for details).
7
8 *-----------------------------------------------------------------------*/
9 /** @file
10 * @brief
11 *
12 * Defines promotions for the vectors resulting from matrix/vector or
13 * vector/matrix ops.
14 *
15 * @sa matvec_ops::mvmul
16 */
17
18 #ifndef matvec_promotions_h
19 #define matvec_promotions_h
20
21 #include <cml/et/scalar_promotions.h>
22 #include <cml/vector/vector_promotions.h>
23
24 namespace cml {
25 namespace et {
26
27 /* Default mat/vec type promotion template. */
28 template<typename LeftT, typename RightT> struct MatVecPromote;
29
30 /** Type promotion for a matrix and a vector. */
31 template<
32 typename E1, class AT1, typename BO, typename L,
33 typename E2, class AT2>
34 struct MatVecPromote< cml::matrix<E1,AT1,BO,L>, cml::vector<E2,AT2> >
35 {
36 typedef cml::matrix<E1,AT1,BO,L> matrix_type;
37 typedef cml::vector<E2,AT2> vector_type;
38
39 /* Promote the arrays: */
40 typedef typename ArrayPromote<
41 typename matrix_type::array_type,
42 typename vector_type::array_type
43 >::type promoted_array;
44
45 /* The deduced vector result type: */
46 typedef cml::vector<
47 typename promoted_array::value_type,
48 typename promoted_array::generator_type
49 > type;
50
51 /* The deduced temporary type: */
52 typedef typename type::temporary_type temporary_type;
53 /* Note: this is to avoid an "incomplete type" error from ICC9, which
54 * can't handle e.g. <X>::<Y>::<Z> when <X> is a template type.
55 */
56 };
57
58 /** Type promotion for a vector and a matrix. */
59 template<
60 typename E1, class AT1,
61 typename E2, class AT2, typename BO, typename L>
62 struct MatVecPromote< cml::vector<E1,AT1>, cml::matrix<E2,AT2,BO,L> >
63 {
64 typedef cml::vector<E1,AT1> vector_type;
65 typedef cml::matrix<E2,AT2,BO,L> matrix_type;
66
67 /* Promote the arrays: */
68 typedef typename ArrayPromote<
69 typename vector_type::array_type,
70 typename matrix_type::array_type
71 >::type promoted_array;
72
73 /* The deduced vector result type: */
74 typedef cml::vector<
75 typename promoted_array::value_type,
76 typename promoted_array::generator_type
77 > type;
78
79 /* The deduced temporary type: */
80 typedef typename type::temporary_type temporary_type;
81 /* Note: this is to avoid an "incomplete type" error from ICC9, which
82 * can't handle e.g. <X>::<Y>::<Z> when <X> is a template type.
83 */
84 };
85
86 } // namespace et
87 } // namespace cml
88
89 #endif
90
91 // -------------------------------------------------------------------------
92 // vim:ft=cpp
This page took 0.031214 seconds and 4 git commands to generate.