glass-dev / glass

Generator for Large Scale Structure
https://glass.readthedocs.io
MIT License
31 stars 7 forks source link

BUG(shells): fix and improve partition() with NNLS #145

Closed ntessore closed 8 months ago

ntessore commented 8 months ago

Most importantly, fixes a bug in partition_nnls() which rendered that function useless.

Secondly, optimises partition_nnls() by using a QR factorisation of the problem before calling nnls() on an equivalent but much smaller problem.

Finally, adds a new integral constraint for both nnls and lstsq which ensures that the sum of the partition recovers the integral of the input function.

Fixes: #144 Fixed: A bug in partition() with the default method. Changed: Both partition(method="nnls") and partition(method="lstsq") now have an additional integral constraint so that the sum of the partition recovers the integral of the input function.