take into account possible inf and nan
This commit is contained in:
@@ -62,7 +62,11 @@ spglue_schur::apply_noalias(SpMat<eT>& out, const SpProxy<T1>& pa, const SpProxy
|
||||
|
||||
if( (pa.get_n_nonzero() == 0) || (pb.get_n_nonzero() == 0) )
|
||||
{
|
||||
out.zeros(pa.get_n_rows(), pa.get_n_cols());
|
||||
if(pa.get_n_nonzero() == 0) { out = pb.Q; }
|
||||
else if(pb.get_n_nonzero() == 0) { out = pa.Q; }
|
||||
|
||||
out *= eT(0); // in case out has inf or nan
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,16 +45,7 @@ spop_scalar_times::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1,spop_
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
if(in.aux != eT(0))
|
||||
{
|
||||
out.init_xform(in.m, priv::functor_scalar_times<eT>(in.aux));
|
||||
}
|
||||
else
|
||||
{
|
||||
const SpProxy<T1> P(in.m);
|
||||
|
||||
out.zeros( P.get_n_rows(), P.get_n_cols() );
|
||||
}
|
||||
out.init_xform(in.m, priv::functor_scalar_times<eT>(in.aux));
|
||||
}
|
||||
|
||||
|
||||
@@ -86,16 +77,7 @@ spop_cx_scalar_times::apply(SpMat< std::complex<typename T1::pod_type> >& out, c
|
||||
typedef typename T1::pod_type T;
|
||||
typedef typename std::complex<T> out_eT;
|
||||
|
||||
if(in.aux_out_eT != out_eT(0))
|
||||
{
|
||||
out.init_xform_mt(in.m, priv::functor_cx_scalar_times<T>(in.aux_out_eT));
|
||||
}
|
||||
else
|
||||
{
|
||||
const SpProxy<T1> P(in.m);
|
||||
|
||||
out.zeros( P.get_n_rows(), P.get_n_cols() );
|
||||
}
|
||||
out.init_xform_mt(in.m, priv::functor_cx_scalar_times<T>(in.aux_out_eT));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user