ARM-software / CMSIS-DSP

CMSIS-DSP embedded compute library for Cortex-M and Cortex-A
https://arm-software.github.io/CMSIS-DSP
Apache License 2.0
512 stars 132 forks source link

[REQUEST] Add Singular Value Decomposition #43

Closed dsm closed 2 months ago

dsm commented 2 years ago

Hi, if it is possible, can someone add SVD transform .

christophe0606 commented 2 years ago

Hi @dsm ,

Thank for the request. It is definitely something I have on my to do list and that I'd like to add to the library.

But before I can start the work, I have concluded I need additional abstractions in CMSIS-DSP to make it easier to build complex kernels. Vectorization and manual unrolling are unfortunately generating codes which are not very readable and maintainable. So, I need something to help me writing a maintainable (and quick) SVD implementation.

Also, I have not yet decided on which implementation. Some are very fast for small matrices but very slow for bigger ones.

I was thinking perhaps about Jacobi SVD and only for square matrices.

Would you need rectangular matrices also ?

In summary, it is on my to do list but I can communicate any schedule and it is likely to take time before it is available in the library.

dsm commented 2 years ago

Yes great to hear that, I need non-square matrices for pseudoinverse using SVD, I have 100-200 sensor data for curve fitting as 5 or 6 degree polynomial

dsm commented 2 years ago

if anything need, I can help

dsm commented 2 years ago

I think maybe implement svd using method of Golub and Reinsch, that repo is implement in pure c

SVD_golub_reinsch

Can you review this, please?

christophe0606 commented 2 years ago

@dsm It is indeed the Golub method I had planned to implement at some point. Unfortunately, it won't be quick since I have lot of other things to do before.

But thanks for sharing this link. It looks interesting !

christophe0606 commented 2 months ago

A new experimental C++ extension has been introduced that should make it much easier to write linear algebra algorithms and get correct performances. It currently does not yet support complex numbers but otherwise should be usable for algorithm like SVD.

We prefer to focus efforts on improving this C++ API and let the ecosystem write the linear algebra algorithms they need.