speedups for empty submatrices
This commit is contained in:
@@ -80,6 +80,8 @@ op_accu_mat::apply_proxy_at(const Proxy<T1>& P)
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
|
||||
if( (n_rows == 0) || (n_cols == 0) ) { return eT(0); }
|
||||
|
||||
eT val = eT(0);
|
||||
|
||||
if(n_rows != 1)
|
||||
@@ -146,6 +148,8 @@ op_accu_mat::apply_omit_helper(const Proxy<T1>& P, functor is_omitted)
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
|
||||
if( (n_rows == 0) || (n_cols == 0) ) { return eT_zero; }
|
||||
|
||||
for(uword c=0; c < n_cols; ++c)
|
||||
for(uword r=0; r < n_rows; ++r)
|
||||
{
|
||||
@@ -602,6 +606,8 @@ op_accu_mat::apply(const subview<eT>& X)
|
||||
const uword X_n_rows = X.n_rows;
|
||||
const uword X_n_cols = X.n_cols;
|
||||
|
||||
if( (X_n_rows == 0) || (X_n_cols == 0) ) { return eT(0); }
|
||||
|
||||
if(X_n_rows == 1)
|
||||
{
|
||||
const uword X_m_n_rows = X.m.n_rows;
|
||||
@@ -750,6 +756,8 @@ op_accu_cube::apply_proxy_at(const ProxyCube<T1>& P)
|
||||
const uword n_cols = P.get_n_cols();
|
||||
const uword n_slices = P.get_n_slices();
|
||||
|
||||
if( (n_rows == 0) || (n_cols == 0) || (n_slices == 0) ) { return eT(0); }
|
||||
|
||||
eT val1 = eT(0);
|
||||
eT val2 = eT(0);
|
||||
|
||||
|
||||
@@ -176,6 +176,8 @@ op_vectorise_col::apply_subview(Mat<eT>& out, const subview<eT>& sv)
|
||||
|
||||
out.set_size(sv.n_elem, 1);
|
||||
|
||||
if(sv.n_elem == 0) { return; }
|
||||
|
||||
eT* out_mem = out.memptr();
|
||||
|
||||
for(uword col=0; col < sv_n_cols; ++col)
|
||||
@@ -201,6 +203,8 @@ op_vectorise_col::apply_proxy(Mat<typename T1::elem_type>& out, const Proxy<T1>&
|
||||
|
||||
out.set_size(N, 1);
|
||||
|
||||
if(N == 0) { return; }
|
||||
|
||||
eT* outmem = out.memptr();
|
||||
|
||||
if(Proxy<T1>::use_at == false)
|
||||
@@ -305,6 +309,8 @@ op_vectorise_row::apply_proxy(Mat<typename T1::elem_type>& out, const Proxy<T1>&
|
||||
|
||||
out.set_size(1, n_elem);
|
||||
|
||||
if(n_elem == 0) { return; }
|
||||
|
||||
eT* outmem = out.memptr();
|
||||
|
||||
if(n_cols == 1)
|
||||
@@ -471,6 +477,8 @@ op_vectorise_cube_col::apply_proxy(Mat<typename T1::elem_type>& out, const T1& e
|
||||
|
||||
out.set_size(N, 1);
|
||||
|
||||
if(N == 0) { return; }
|
||||
|
||||
eT* outmem = out.memptr();
|
||||
|
||||
if(ProxyCube<T1>::use_at == false)
|
||||
|
||||
Reference in New Issue
Block a user