fix calculation of s

This commit is contained in:
conrad
2025-04-23 13:24:40 +10:00
parent f77f5c3d0f
commit b613bdb306
+4 -4
View File
@@ -108,11 +108,11 @@ op_expmat::apply_direct(Mat<typename T1::elem_type>& out, const Base<typename T1
if(arma_isfinite(norm_val) == false) { return false; }
const double log2_val = (norm_val > T(0)) ? double(eop_aux::log2(norm_val)) : double(0);
int exponent = int(0); std::frexp(norm_val, &exponent);
int exponent = int(0); std::frexp(log2_val, &exponent);
const uword s = (std::min)( uword( (std::max)(int(0), exponent) ), uword(1023) );
const uword s = uword( (std::max)(int(0), exponent + int(1)) );
arma_debug_print("op_expmat: s: ", s);
A /= eT(eop_aux::pow(double(2), double(s)));
@@ -125,7 +125,7 @@ op_expmat::apply_direct(Mat<typename T1::elem_type>& out, const Base<typename T1
bool positive = true;
const uword N = 6;
const uword N = 8;
for(uword i = 2; i <= N; ++i)
{