From 44861dcbfeee041223c4aac1ee075e92fa4daa01 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Sep 2016 12:42:15 +0200 Subject: update --- eigen/blas/PackedSelfadjointProduct.h | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 eigen/blas/PackedSelfadjointProduct.h (limited to 'eigen/blas/PackedSelfadjointProduct.h') diff --git a/eigen/blas/PackedSelfadjointProduct.h b/eigen/blas/PackedSelfadjointProduct.h new file mode 100644 index 0000000..07327a2 --- /dev/null +++ b/eigen/blas/PackedSelfadjointProduct.h @@ -0,0 +1,53 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Chen-Pang He +// +// This Source Code Form is subject to the terms of the Mozilla +// 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_SELFADJOINT_PACKED_PRODUCT_H +#define EIGEN_SELFADJOINT_PACKED_PRODUCT_H + +namespace internal { + +/* Optimized matrix += alpha * uv' + * The matrix is in packed form. + */ +template +struct selfadjoint_packed_rank1_update; + +template +struct selfadjoint_packed_rank1_update +{ + typedef typename NumTraits::Real RealScalar; + static void run(Index size, Scalar* mat, const Scalar* vec, RealScalar alpha) + { + typedef Map > OtherMap; + typedef typename conj_expr_if::type ConjRhsType; + conj_if cj; + + for (Index i=0; i >(mat, UpLo==Lower ? size-i : (i+1)) += alpha * cj(vec[i]) * ConjRhsType(OtherMap(vec+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1))); + //FIXME This should be handled outside. + mat[UpLo==Lower ? 0 : i] = numext::real(mat[UpLo==Lower ? 0 : i]); + mat += UpLo==Lower ? size-i : (i+1); + } + } +}; + +template +struct selfadjoint_packed_rank1_update +{ + typedef typename NumTraits::Real RealScalar; + static void run(Index size, Scalar* mat, const Scalar* vec, RealScalar alpha) + { + selfadjoint_packed_rank1_update::run(size,mat,vec,alpha); + } +}; + +} // end namespace internal + +#endif // EIGEN_SELFADJOINT_PACKED_PRODUCT_H -- cgit v1.2.3