aboutsummaryrefslogtreecommitdiffhomepage
path: root/blas/GeneralRank1Update.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2012-09-11 21:36:05 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2012-09-11 21:36:05 +0200
commit28528519e9584c16ef2bb88461d4b7fe0b114bf0 (patch)
treea80585e30e57de6f470cc07ea96ac39cc80716ce /blas/GeneralRank1Update.h
parent9e80822fc974c7883d23b197a1a1063d34602420 (diff)
parent04f315d692d4b2b01635981d34b44743ba63571c (diff)
Merged in jdh8/eigen (pull request PR-17)
Diffstat (limited to 'blas/GeneralRank1Update.h')
-rw-r--r--blas/GeneralRank1Update.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/blas/GeneralRank1Update.h b/blas/GeneralRank1Update.h
index a3301ed92..07d388c88 100644
--- a/blas/GeneralRank1Update.h
+++ b/blas/GeneralRank1Update.h
@@ -13,15 +13,29 @@
namespace internal {
/* Optimized matrix += alpha * uv' */
-template<typename Scalar, typename Index, bool ConjRhs>
-struct general_rank1_update
+template<typename Scalar, typename Index, int StorageOrder, bool ConjLhs, bool ConjRhs>
+struct general_rank1_update;
+
+template<typename Scalar, typename Index, bool ConjLhs, bool ConjRhs>
+struct general_rank1_update<Scalar,Index,ColMajor,ConjLhs,ConjRhs>
{
static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha)
{
- typedef Matrix<Scalar,Dynamic,1> PlainVector;
- internal::conj_if<ConjRhs> cj;
+ typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;
+ typedef typename conj_expr_if<ConjLhs,OtherMap>::type ConjRhsType;
+ conj_if<ConjRhs> cj;
+
for (Index i=0; i<cols; ++i)
- Map<PlainVector>(mat+stride*i,rows) += alpha * cj(v[i]) * Map<const PlainVector>(u,rows);
+ Map<Matrix<Scalar,Dynamic,1> >(mat+stride*i,rows) += alpha * cj(v[i]) * ConjRhsType(OtherMap(u,rows));
+ }
+};
+
+template<typename Scalar, typename Index, bool ConjLhs, bool ConjRhs>
+struct general_rank1_update<Scalar,Index,RowMajor,ConjLhs,ConjRhs>
+{
+ static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha)
+ {
+ general_rank1_update<Scalar,Index,ColMajor,ConjRhs,ConjRhs>::run(rows,cols,mat,stride,u,v,alpha);
}
};