giaf / blasfeo

Basic linear algebra subroutines for embedded optimization
Other
308 stars 84 forks source link

Add routine for sparse vector addition #150

Closed FreyJo closed 2 years ago

FreyJo commented 2 years ago
// z += alpha * x[idx]
void blasfeo_dvec_add_sp_in(int m, double alpha, int *idx, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi);

Maybe should be renamed.

giaf commented 2 years ago

Thanks for the proposal of adding this additional auxiliary routine. I would suggest to call the routine blasfeo_dvecexad_sp (i.e. vector extract and add - sparse variant). I think this would be more consistent with the existing routines, and when I have some time I would possibly also rename blasfeo_dvecad_sp into blasfeo_dvecinad_sp, but that's another story.

The new routine should be added to some additional files. The following files seem to be missing:

If you can make these changes, then I can merge the PR straight away.

FreyJo commented 2 years ago

Thanks for checking! It is all addressed in the last commit.

giaf commented 2 years ago

Two more small fixes and then we should be good. With all the different targets and backends each single routine ends up in a lot of different places :p

FreyJo commented 2 years ago

yes, now it should be fine.

With all the different targets and backends each single routine ends up in a lot of different places :p

Great that you still have the overview :D

giaf commented 2 years ago

I try my best :p Here it was mainly a matter of symmetry with the double precision version that was already correct.