diff --git a/include/armadillo_bits/op_orth_null_meat.hpp b/include/armadillo_bits/op_orth_null_meat.hpp index 91d6ee4a..23e34049 100644 --- a/include/armadillo_bits/op_orth_null_meat.hpp +++ b/include/armadillo_bits/op_orth_null_meat.hpp @@ -56,13 +56,24 @@ op_orth::apply_direct(Mat& out, const Base= 0"); - Mat A(expr.get_ref()); - Mat U; Col< T> s; Mat V; - const bool status = auxlib::svd_dc(U, s, V, A); // TODO: refactor to avoid dc if matrix size too large + Mat A(expr.get_ref()); + + const uword N = (std::min)(A.n_rows, A.n_cols); + + const uword N_limit = (is_cx::yes) ? uword(20000) : uword(23000); + + const bool allow_dc = (sizeof(blas_int) >= std::size_t(8)) ? true : (N <= N_limit); + + if(allow_dc == false) + { + arma_warn(3, "orth(): matrix size too large for divide-and-conquer algorithm; using standard algorithm instead"); + } + + const bool status = (allow_dc) ? auxlib::svd_dc(U, s, V, A) : auxlib::svd(U, s, V, A); V.reset(); @@ -132,13 +143,24 @@ op_null::apply_direct(Mat& out, const Base= 0"); - Mat A(expr.get_ref()); - Mat U; Col< T> s; Mat V; - const bool status = auxlib::svd_dc(U, s, V, A); // TODO: refactor to avoid dc if matrix size too large + Mat A(expr.get_ref()); + + const uword N = (std::min)(A.n_rows, A.n_cols); + + const uword N_limit = (is_cx::yes) ? uword(20000) : uword(23000); + + const bool allow_dc = (sizeof(blas_int) >= std::size_t(8)) ? true : (N <= N_limit); + + if(allow_dc == false) + { + arma_warn(3, "null(): matrix size too large for divide-and-conquer algorithm; using standard algorithm instead"); + } + + const bool status = (allow_dc) ? auxlib::svd_dc(U, s, V, A) : auxlib::svd(U, s, V, A); U.reset();