diff --git a/Eigen/QR b/Eigen/QR index 5f36d0987..ecebd32e4 100644 --- a/Eigen/QR +++ b/Eigen/QR @@ -6,6 +6,7 @@ #include "src/Core/util/DisableMSVCWarnings.h" #include "Cholesky" +#include "Jacobi" // Note that EIGEN_HIDE_HEAVY_CODE has to be defined per module #if (defined EIGEN_EXTERN_INSTANTIATIONS) && (EIGEN_EXTERN_INSTANTIATIONS>=2) diff --git a/Eigen/src/Core/products/RotationInThePlane.h b/Eigen/src/Core/products/RotationInThePlane.h deleted file mode 100644 index 7fc62c675..000000000 --- a/Eigen/src/Core/products/RotationInThePlane.h +++ /dev/null @@ -1,127 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2009 Gael Guennebaud -// -// Eigen is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 3 of the License, or (at your option) any later version. -// -// Alternatively, you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License and a copy of the GNU General Public License along with -// Eigen. If not, see . - -#ifndef EIGEN_ROTATION_IN_THE_PLANE_H -#define EIGEN_ROTATION_IN_THE_PLANE_H - -/********************************************************************** -* This file implement ... -**********************************************************************/ - -template -struct ei_apply_rotation_in_the_plane_selector; - -template -void ei_apply_rotation_in_the_plane(VectorX& x, VectorY& y, typename VectorX::Scalar c, typename VectorY::Scalar s) -{ - ei_assert(x.size() == y.size()); - int size = x.size(); - int incrx = size ==1 ? 1 : &x.coeffRef(1) - &x.coeffRef(0); - int incry = size ==1 ? 1 : &y.coeffRef(1) - &y.coeffRef(0); - if (incrx==1 && incry==1) - ei_apply_rotation_in_the_plane_selector - ::run(&x.coeffRef(0), &y.coeffRef(0), x.size(), c, s, 1, 1); - else - ei_apply_rotation_in_the_plane_selector - ::run(&x.coeffRef(0), &y.coeffRef(0), x.size(), c, s, incrx, incry); -} - -template -struct ei_apply_rotation_in_the_plane_selector -{ - static void run(Scalar* x, Scalar* y, int size, Scalar c, Scalar s, int incrx, int incry) - { - for(int i=0; i vectorization -template -struct ei_apply_rotation_in_the_plane_selector -{ - static void run(Scalar* x, Scalar* y, int size, Scalar c, Scalar s, int, int) - { - typedef typename ei_packet_traits::type Packet; - enum { PacketSize = ei_packet_traits::size, Peeling = 2 }; - int alignedStart = ei_alignmentOffset(y, size); - int alignedEnd = alignedStart + ((size-alignedStart)/(Peeling*PacketSize))*(Peeling*PacketSize); - - const Packet pc = ei_pset1(c); - const Packet ps = ei_pset1(s); - - for(int i=0; i +// Copyright (C) 2009 Gael Guennebaud // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -25,6 +26,9 @@ #ifndef EIGEN_JACOBI_H #define EIGEN_JACOBI_H +template +void ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, typename VectorX::Scalar c, typename VectorY::Scalar s); + template inline void MatrixBase::applyJacobiOnTheLeft(int p, int q, Scalar c, Scalar s) { @@ -101,5 +105,98 @@ inline void ei_normalizeJacobi(Scalar *c, Scalar *s, const Scalar& x, const Scal } } +template +void /*EIGEN_DONT_INLINE*/ ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, typename VectorX::Scalar c, typename VectorY::Scalar s) +{ + typedef typename VectorX::Scalar Scalar; + ei_assert(_x.size() == _y.size()); + int size = _x.size(); + int incrx = size ==1 ? 1 : &_x.coeffRef(1) - &_x.coeffRef(0); + int incry = size ==1 ? 1 : &_y.coeffRef(1) - &_y.coeffRef(0); + + Scalar* EIGEN_RESTRICT x = &_x.coeffRef(0); + Scalar* EIGEN_RESTRICT y = &_y.coeffRef(0); + + if (incrx==1 && incry==1) + { + // both vectors are sequentially stored in memory => vectorization + typedef typename ei_packet_traits::type Packet; + enum { PacketSize = ei_packet_traits::size, Peeling = 2 }; + + int alignedStart = ei_alignmentOffset(y, size); + int alignedEnd = alignedStart + ((size-alignedStart)/PacketSize)*PacketSize; + + const Packet pc = ei_pset1(c); + const Packet ps = ei_pset1(s); + + for(int i=0; i