handle use_at

This commit is contained in:
conrad
2022-01-10 15:00:19 +10:00
parent 39d7e52edd
commit bf58905ccc
+50 -17
View File
@@ -324,24 +324,57 @@ op_find::helper
uword* indices_mem = indices.memptr();
uword n_nz = 0;
for(uword i=0; i<n_elem; ++i)
if((Proxy<T1>::use_at == false) && (Proxy<T2>::use_at == false))
{
const eT1 tmp1 = PA[i];
const eT2 tmp2 = PB[i];
for(uword i=0; i<n_elem; ++i)
{
const eT1 tmp1 = PA[i];
const eT2 tmp2 = PB[i];
bool not_zero;
if(is_same_type<glue_type, glue_rel_lt >::yes) { not_zero = (tmp1 < tmp2); }
else if(is_same_type<glue_type, glue_rel_gt >::yes) { not_zero = (tmp1 > tmp2); }
else if(is_same_type<glue_type, glue_rel_lteq >::yes) { not_zero = (tmp1 <= tmp2); }
else if(is_same_type<glue_type, glue_rel_gteq >::yes) { not_zero = (tmp1 >= tmp2); }
else if(is_same_type<glue_type, glue_rel_eq >::yes) { not_zero = (tmp1 == tmp2); }
else if(is_same_type<glue_type, glue_rel_noteq >::yes) { not_zero = (tmp1 != tmp2); }
else if(is_same_type<glue_type, glue_rel_and >::yes) { not_zero = (tmp1 && tmp2); }
else if(is_same_type<glue_type, glue_rel_or >::yes) { not_zero = (tmp1 || tmp2); }
else { not_zero = false; }
if(not_zero) { indices_mem[n_nz] = i; ++n_nz; }
}
}
else
{
const uword n_rows = A.get_n_rows();
const uword n_cols = A.get_n_cols();
bool not_zero;
uword i = 0;
if(is_same_type<glue_type, glue_rel_lt >::yes) { not_zero = (tmp1 < tmp2); }
else if(is_same_type<glue_type, glue_rel_gt >::yes) { not_zero = (tmp1 > tmp2); }
else if(is_same_type<glue_type, glue_rel_lteq >::yes) { not_zero = (tmp1 <= tmp2); }
else if(is_same_type<glue_type, glue_rel_gteq >::yes) { not_zero = (tmp1 >= tmp2); }
else if(is_same_type<glue_type, glue_rel_eq >::yes) { not_zero = (tmp1 == tmp2); }
else if(is_same_type<glue_type, glue_rel_noteq >::yes) { not_zero = (tmp1 != tmp2); }
else if(is_same_type<glue_type, glue_rel_and >::yes) { not_zero = (tmp1 && tmp2); }
else if(is_same_type<glue_type, glue_rel_or >::yes) { not_zero = (tmp1 || tmp2); }
else { not_zero = false; }
if(not_zero) { indices_mem[n_nz] = i; ++n_nz; }
for(uword col=0; col < n_cols; ++col)
for(uword row=0; row < n_rows; ++row)
{
const eT1 tmp1 = A.at(row,col);
const eT2 tmp2 = B.at(row,col);
bool not_zero;
if(is_same_type<glue_type, glue_rel_lt >::yes) { not_zero = (tmp1 < tmp2); }
else if(is_same_type<glue_type, glue_rel_gt >::yes) { not_zero = (tmp1 > tmp2); }
else if(is_same_type<glue_type, glue_rel_lteq >::yes) { not_zero = (tmp1 <= tmp2); }
else if(is_same_type<glue_type, glue_rel_gteq >::yes) { not_zero = (tmp1 >= tmp2); }
else if(is_same_type<glue_type, glue_rel_eq >::yes) { not_zero = (tmp1 == tmp2); }
else if(is_same_type<glue_type, glue_rel_noteq >::yes) { not_zero = (tmp1 != tmp2); }
else if(is_same_type<glue_type, glue_rel_and >::yes) { not_zero = (tmp1 && tmp2); }
else if(is_same_type<glue_type, glue_rel_or >::yes) { not_zero = (tmp1 || tmp2); }
else { not_zero = false; }
if(not_zero) { indices_mem[n_nz] = i; ++n_nz; }
i++;
}
}
return n_nz;
@@ -385,7 +418,7 @@ op_find::helper
uword n_nz = 0;
if(Proxy<T1>::use_at == false)
if((Proxy<T1>::use_at == false) && (Proxy<T2>::use_at == false))
{
for(uword i=0; i<n_elem; ++i)
{
@@ -418,7 +451,7 @@ op_find::helper
i++;
}
}
}
return n_nz;
}