wrtobin / las

Zero-overhead interfaces to Linear Algebraic data structures and Solvers
1 stars 1 forks source link

Apply zero() #30

Closed kumargp closed 6 years ago

kumargp commented 6 years ago

The following zero() will reset it after creating!.

las::LasCreateMat *dens_fct = las::getMatBuilderlas::dense(0);
auto *dOps = las::getLASOpslas::dense();
las::Mat *mDens = dens_fct->create(0, 0, las::createDensity(nvtx, nphi, src_real_dbl), MPI_COMM_SELF);
dOps->zero(mDens);
wrtobin commented 6 years ago

I don't understand, please be more explicit about what the issue is.

kumargp commented 6 years ago

Sorry, I wanted to write, that this step can be added in exec(), since the empty dense matrix is created there.

kumargp commented 6 years ago

Or, initialize each element to 0 before adding , in exec

     for(int xrw = 0; xrw < x_nr; ++xrw)
        for(int ycl = 0; ycl < y_nc; ++ycl)
        {
           (*z)(xrw,ycl) = 0;
           for(int inr = 0; inr < x_nc; ++inr)
              (*z)(xrw,ycl) += (*x)(xrw,inr) * (*y)(inr,ycl);
         } 
wrtobin commented 6 years ago

added in 158ee29b01431c118c5f4e2233ae7ba675231174 and merged to master