Main MRPT website > C++ reference
MRPT logo

SelfadjointProduct.h

Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 //
00006 // Eigen is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 3 of the License, or (at your option) any later version.
00010 //
00011 // Alternatively, you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License as
00013 // published by the Free Software Foundation; either version 2 of
00014 // the License, or (at your option) any later version.
00015 //
00016 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00017 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00019 // GNU General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License and a copy of the GNU General Public License along with
00023 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00024 
00025 #ifndef EIGEN_SELFADJOINT_PRODUCT_H
00026 #define EIGEN_SELFADJOINT_PRODUCT_H
00027 
00028 /**********************************************************************
00029 * This file implements a self adjoint product: C += A A^T updating only
00030 * half of the selfadjoint matrix C.
00031 * It corresponds to the level 3 SYRK Blas routine.
00032 **********************************************************************/
00033 
00034 // high level API
00035 
00036 template<typename MatrixType, unsigned int UpLo>
00037 template<typename DerivedU>
00038 SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
00039 ::rankUpdate(const MatrixBase<DerivedU>& u, Scalar alpha)
00040 {
00041   typedef internal::blas_traits<DerivedU> UBlasTraits;
00042   typedef typename UBlasTraits::DirectLinearAccessType ActualUType;
00043   typedef typename internal::remove_all<ActualUType>::type _ActualUType;
00044   const ActualUType actualU = UBlasTraits::extract(u.derived());
00045 
00046   Scalar actualAlpha = alpha * UBlasTraits::extractScalarFactor(u.derived());
00047 
00048   enum { IsRowMajor = (internal::traits<MatrixType>::Flags&RowMajorBit) ? 1 : 0 };
00049   
00050   internal::general_matrix_matrix_triangular_product<Index,
00051     Scalar, _ActualUType::Flags&RowMajorBit ? RowMajor : ColMajor,   UBlasTraits::NeedToConjugate  && NumTraits<Scalar>::IsComplex,
00052     Scalar, _ActualUType::Flags&RowMajorBit ? ColMajor : RowMajor, (!UBlasTraits::NeedToConjugate) && NumTraits<Scalar>::IsComplex,
00053     MatrixType::Flags&RowMajorBit ? RowMajor : ColMajor, UpLo>
00054     ::run(_expression().cols(), actualU.cols(),
00055           &actualU.coeffRef(0,0), actualU.outerStride(), &actualU.coeffRef(0,0), actualU.outerStride(),
00056           _expression().const_cast_derived().data(), _expression().outerStride(), actualAlpha);
00057 
00058   return *this;
00059 }
00060 
00061 #endif // EIGEN_SELFADJOINT_PRODUCT_H



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011