Skip to content

Reduce the number subtractions in get_lagrange_coefficients by half#657

Open
jonas-lj wants to merge 6 commits intomainfrom
jonas/optimise_lagrange
Open

Reduce the number subtractions in get_lagrange_coefficients by half#657
jonas-lj wants to merge 6 commits intomainfrom
jonas/optimise_lagrange

Conversation

@jonas-lj
Copy link
Copy Markdown
Contributor

@jonas-lj jonas-lj commented Sep 30, 2023

It's possible to cache the n^2 differences computed in get_lagrange_coefficients and use this to reduce the number of subtractions by half.

I'm not sure this is a bottleneck as it is, but I did some profiling with 1000 indices and here, about 20-25% of the time is spent on the subtractions.

@benr-ml Feel free to use this if you think it's needed, otherwise you can just close the PR.

@benr-ml
Copy link
Copy Markdown
Contributor

benr-ml commented Oct 1, 2023

Great idea!
Since in practice we compute those coefficients for the same set of parties many times, I wonder if we should generate the cache in a preprocessing stage and just pass it as an optional input. Let me think about that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants