From 3ee77a6ded8b2590a59fa8dd0bebefd645fe308c Mon Sep 17 00:00:00 2001 From: conrad Date: Thu, 18 Nov 2021 14:30:04 +1000 Subject: [PATCH] optimised handling of diagonal matrices --- include/armadillo_bits/op_inv_meat.hpp | 39 +++++++++++++++----------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/include/armadillo_bits/op_inv_meat.hpp b/include/armadillo_bits/op_inv_meat.hpp index 69a46958..e8af684c 100644 --- a/include/armadillo_bits/op_inv_meat.hpp +++ b/include/armadillo_bits/op_inv_meat.hpp @@ -306,7 +306,7 @@ op_inv_sympd::apply_direct(Mat& out, const Base& out, const Base::no) && (out.is_diagmat())) - // { - // const uword N = (std::min)(out.n_rows, out.n_cols); - // - // for(uword i=0; i::no) && (out.is_diagmat())) + { + // specialised handling of real matrices only; + // currently auxlib::inv_sympd() does not enforce that + // imaginary components of diagonal elements must be zero; + // strictly enforcing this constraint may break existing user software. + + const uword N = (std::min)(out.n_rows, out.n_cols); + + for(uword i=0; i