X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2Fcml%2Fmatvec%2Fmatvec_promotions.h;fp=src%2FMoof%2Fcml%2Fmatvec%2Fmatvec_promotions.h;h=3b85d1ff364d311217cef6ac8d3ab451f542eda8;hp=0000000000000000000000000000000000000000;hb=c2321281bf12a7efaedde930422c7ddbc92080d4;hpb=87bc17e55b0c1dc73ecc66df856d3f08fd7a7724 diff --git a/src/Moof/cml/matvec/matvec_promotions.h b/src/Moof/cml/matvec/matvec_promotions.h new file mode 100644 index 0000000..3b85d1f --- /dev/null +++ b/src/Moof/cml/matvec/matvec_promotions.h @@ -0,0 +1,92 @@ +/* -*- C++ -*- ------------------------------------------------------------ + +Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/ + +The Configurable Math Library (CML) is distributed under the terms of the +Boost Software License, v1.0 (see cml/LICENSE for details). + + *-----------------------------------------------------------------------*/ +/** @file + * @brief + * + * Defines promotions for the vectors resulting from matrix/vector or + * vector/matrix ops. + * + * @sa matvec_ops::mvmul + */ + +#ifndef matvec_promotions_h +#define matvec_promotions_h + +#include +#include + +namespace cml { +namespace et { + +/* Default mat/vec type promotion template. */ +template struct MatVecPromote; + +/** Type promotion for a matrix and a vector. */ +template< + typename E1, class AT1, typename BO, typename L, + typename E2, class AT2> +struct MatVecPromote< cml::matrix, cml::vector > +{ + typedef cml::matrix matrix_type; + typedef cml::vector vector_type; + + /* Promote the arrays: */ + typedef typename ArrayPromote< + typename matrix_type::array_type, + typename vector_type::array_type + >::type promoted_array; + + /* The deduced vector result type: */ + typedef cml::vector< + typename promoted_array::value_type, + typename promoted_array::generator_type + > type; + + /* The deduced temporary type: */ + typedef typename type::temporary_type temporary_type; + /* Note: this is to avoid an "incomplete type" error from ICC9, which + * can't handle e.g. :::: when is a template type. + */ +}; + +/** Type promotion for a vector and a matrix. */ +template< + typename E1, class AT1, + typename E2, class AT2, typename BO, typename L> +struct MatVecPromote< cml::vector, cml::matrix > +{ + typedef cml::vector vector_type; + typedef cml::matrix matrix_type; + + /* Promote the arrays: */ + typedef typename ArrayPromote< + typename vector_type::array_type, + typename matrix_type::array_type + >::type promoted_array; + + /* The deduced vector result type: */ + typedef cml::vector< + typename promoted_array::value_type, + typename promoted_array::generator_type + > type; + + /* The deduced temporary type: */ + typedef typename type::temporary_type temporary_type; + /* Note: this is to avoid an "incomplete type" error from ICC9, which + * can't handle e.g. :::: when is a template type. + */ +}; + +} // namespace et +} // namespace cml + +#endif + +// ------------------------------------------------------------------------- +// vim:ft=cpp