1 /* -*- C++ -*- ------------------------------------------------------------
3 Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/
5 The Configurable Math Library (CML) is distributed under the terms of the
6 Boost Software License, v1.0 (see cml/LICENSE for details).
8 *-----------------------------------------------------------------------*/
12 * Defines promotions for the vectors resulting from matrix/vector or
15 * @sa matvec_ops::mvmul
18 #ifndef matvec_promotions_h
19 #define matvec_promotions_h
21 #include <cml/et/scalar_promotions.h>
22 #include <cml/vector/vector_promotions.h>
27 /* Default mat/vec type promotion template. */
28 template<typename LeftT
, typename RightT
> struct MatVecPromote
;
30 /** Type promotion for a matrix and a vector. */
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
> >
36 typedef cml::matrix
<E1
,AT1
,BO
,L
> matrix_type
;
37 typedef cml::vector
<E2
,AT2
> vector_type
;
39 /* Promote the arrays: */
40 typedef typename ArrayPromote
<
41 typename
matrix_type::array_type
,
42 typename
vector_type::array_type
43 >::type promoted_array
;
45 /* The deduced vector result type: */
47 typename
promoted_array::value_type
,
48 typename
promoted_array::generator_type
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.
58 /** Type promotion for a vector and a matrix. */
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
> >
64 typedef cml::vector
<E1
,AT1
> vector_type
;
65 typedef cml::matrix
<E2
,AT2
,BO
,L
> matrix_type
;
67 /* Promote the arrays: */
68 typedef typename ArrayPromote
<
69 typename
vector_type::array_type
,
70 typename
matrix_type::array_type
71 >::type promoted_array
;
73 /* The deduced vector result type: */
75 typename
promoted_array::value_type
,
76 typename
promoted_array::generator_type
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.
91 // -------------------------------------------------------------------------