Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PlainMatrix and SecureMatrix #27

Closed
wants to merge 17 commits into from

Conversation

ArseniyKholod
Copy link
Collaborator

@ArseniyKholod ArseniyKholod commented Apr 12, 2024

I was wondering about 2D simulations and thought, that it should not be so difficult to add PlainMatrix and SecureMatrix based on currently existing PlainVector and SecureVector, this is my try.
I pinned OpenFHE_jll to v1.1.2 to let tests run.

Copy link

codecov bot commented Apr 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
examples/simple_ckks_bootstrapping_matrix.jl 100.00% <100.00%> (ø)
examples/simple_real_numbers_matrix.jl 100.00% <100.00%> (ø)
src/SecureArithmetic.jl 100.00% <ø> (ø)
src/arithmetic.jl 100.00% <100.00%> (ø)
src/openfhe.jl 100.00% <100.00%> (ø)
src/operations.jl 100.00% <100.00%> (ø)
src/types.jl 100.00% <100.00%> (ø)
src/unencrypted.jl 100.00% <100.00%> (ø)

@ArseniyKholod ArseniyKholod marked this pull request as draft April 17, 2024 18:33
@ArseniyKholod
Copy link
Collaborator Author

ArseniyKholod commented Apr 18, 2024

Unfortunately, the concept used in the previous commits is not useful, because of the extremely bad efficiency. I tried to build a secure matrix simply combining many secure vectors as rows of the matrix, but e.g. for 40 * 40 Matrix it's necessary to use 40 SecureVector. 40 * 40 matrix could be fit in a single SecureVector with dimension of the ring more than 3200. In case of using 40 such vectors to hold a single matrix, that could fit in a single, all computations become 40 times slower. The solution could be to decrease a ring dimension for these vectors used in a matrix, but due to the security reason it's almost impossible. So as a next step I will try to find a way to fit a matrix in a single vector, simply fusing all rows together and define all necessary arithmetical operations on it.

@sloede
Copy link
Member

sloede commented Apr 18, 2024

Unfortunately, the concept used in the previous commits is not useful, because of the extremely bad efficiency. I tried to build a secure matrix simply combining many secure vectors as rows of the matrix, but e.g. for 40 * 40 Matrix it's necessary to use 40 SecureVector. 40 * 40 matrix could be fit in a single SecureVector with dimension of the ring more than 3200. In case of using 40 such vectors to hold a single matrix, that could fit in a single, all computations become 40 times slower. The solution could be to decrease a ring dimension for these vectors used in a matrix, but due to the security reason it's almost impossible. So as a next step I will try to find a way to fit a matrix in a single vector, simply fusing all rows together and define all necessary arithmetical operations on it.

Thanks, very interesting findings. Please make sure that you record your measurements such that we can use them in a publication or talk.

@sloede
Copy link
Member

sloede commented Apr 18, 2024

It might be worthwhile to search the Discourse for terms related to matrix: https://openfhe.discourse.group/search?q=matrix

The first few results seem interesting, but also indicate that it might be a non-trivial goal to achieve (at least if trying to do it efficiently).

@ArseniyKholod
Copy link
Collaborator Author

It might be worthwhile to search the Discourse for terms related to matrix: https://openfhe.discourse.group/search?q=matrix

The first few results seem interesting, but also indicate that it might be a non-trivial goal to achieve (at least if trying to do it efficiently).

Thanks for the idea! I will record all results!

@sloede
Copy link
Member

sloede commented Nov 7, 2024

Is this still relevant? I lost track whether this is already implemented in SA.jl or not...

@ArseniyKholod ArseniyKholod deleted the matrix branch November 9, 2024 19:47
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