diff options
Diffstat (limited to 'third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h')
-rw-r--r-- | third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h index 18b5085b89..ad11d3d44b 100644 --- a/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h +++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/MatVecProduct.h @@ -7,9 +7,8 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#ifndef EIGEN_CXX11_FIXED_POINT_MAT_VEC_PRODUCT_H -#define EIGEN_CXX11_FIXED_POINT_MAT_VEC_PRODUCT_H - +#ifndef CXX11_SRC_FIXEDPOINT_MATVECPRODUCT_H_ +#define CXX11_SRC_FIXEDPOINT_MATVECPRODUCT_H_ namespace Eigen { namespace internal { @@ -47,6 +46,36 @@ EIGEN_DONT_INLINE void general_matrix_vector_product<Index,QInt8,LhsMapper,ColMa } } +// Mat-Vec product +// Both lhs and rhs are encoded as 16bit signed integers +template <typename Index, typename LhsMapper, bool ConjugateLhs, + typename RhsMapper, bool ConjugateRhs, int Version> +struct general_matrix_vector_product<Index, QInt16, LhsMapper, ColMajor, + ConjugateLhs, QInt16, RhsMapper, + ConjugateRhs, Version> { + EIGEN_DONT_INLINE static void run(Index rows, Index cols, + const LhsMapper& lhs, const RhsMapper& rhs, + QInt32* res, Index resIncr, QInt16 alpha); +}; + +template <typename Index, typename LhsMapper, bool ConjugateLhs, + typename RhsMapper, bool ConjugateRhs, int Version> +EIGEN_DONT_INLINE void general_matrix_vector_product< + Index, QInt16, LhsMapper, ColMajor, ConjugateLhs, QInt16, RhsMapper, + ConjugateRhs, Version>::run(Index rows, Index cols, const LhsMapper& lhs, + const RhsMapper& rhs, QInt32* res, + Index resIncr, QInt16 alpha) { + eigen_assert(alpha.value == 1); + eigen_assert(resIncr == 1); + eigen_assert(rows > 0); + eigen_assert(cols > 0); + + for (Index i = 0; i < rows; ++i) { + for (Index j = 0; j < cols; ++j) { + res[i] += lhs(i, j) * rhs(j, 0); + } + } +} // Mat-Vec product // The lhs is encoded using 8bit signed integers, the rhs using 8bit unsigned integers @@ -118,6 +147,4 @@ EIGEN_DONT_INLINE void general_matrix_vector_product<Index,QUInt8,LhsMapper,ColM } // namespace internal } // namespace Eigen - - -#endif // EIGEN_CXX11_FIXED_POINT_MAT_VEC_PRODUCT_H +#endif // CXX11_SRC_FIXEDPOINT_MATVECPRODUCT_H_ |