simplifications
This commit is contained in:
@@ -40,14 +40,6 @@ class op_inv_spd_full
|
||||
{
|
||||
public:
|
||||
|
||||
template<const uword row, const uword col>
|
||||
struct pos
|
||||
{
|
||||
static constexpr uword n2 = row + col*2;
|
||||
static constexpr uword n3 = row + col*3;
|
||||
static constexpr uword n4 = row + col*4;
|
||||
};
|
||||
|
||||
template<typename T1>
|
||||
inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_inv_spd_full>& in);
|
||||
|
||||
|
||||
@@ -203,9 +203,9 @@ op_inv_spd_full::apply_tiny_2x2(Mat<eT>& X)
|
||||
|
||||
eT* Xm = X.memptr();
|
||||
|
||||
const T a = access::tmp_real(Xm[pos<0,0>::n2]);
|
||||
const T c = access::tmp_real(Xm[pos<1,0>::n2]);
|
||||
const T d = access::tmp_real(Xm[pos<1,1>::n2]);
|
||||
T a = access::tmp_real(Xm[0]);
|
||||
T c = access::tmp_real(Xm[1]);
|
||||
T d = access::tmp_real(Xm[3]);
|
||||
|
||||
const T det_val = (a*d - c*c);
|
||||
|
||||
@@ -218,10 +218,14 @@ op_inv_spd_full::apply_tiny_2x2(Mat<eT>& X)
|
||||
// NOTE: since det_min is positive, this also checks whether det_val is positive
|
||||
if((det_val < det_min) || (det_val > det_max)) { return false; }
|
||||
|
||||
Xm[pos<0,0>::n2] = d / det_val;
|
||||
Xm[pos<0,1>::n2] = -c / det_val;
|
||||
Xm[pos<1,0>::n2] = -c / det_val;
|
||||
Xm[pos<1,1>::n2] = a / det_val;
|
||||
d /= det_val;
|
||||
c /= det_val;
|
||||
a /= det_val;
|
||||
|
||||
Xm[0] = d;
|
||||
Xm[1] = -c;
|
||||
Xm[2] = -c;
|
||||
Xm[3] = a;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user