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

Feature/sampling correlation matrices #233

Merged

Conversation

huuphuocle
Copy link
Contributor

Hi all,
Here is a PR for sampling correlation matrices with uniform billiard walk.
Main new files are:

  • ./examples/correlation_matrices/ (user functions for sampling, test functions)
  • ./include/convex_bodies/correlation_matrices/ (new correlation matrix class)
  • ./include/matrix_operations/EigenvaluesCorrelation.h (modified eigenvalue problems)

To test: execute bash script ./examples/correlation_matrices/test.sh then input a value for n from keyboard.
The code will run the new implementation and the one use Spectrahedron class and their timings. There is a commented line
check_output in test.hpp which can be uncommented to check the correctness of output,

The speed up comes from reflection operator (adapt the computation with special LMI) and linear intersection (Eigen Generalized Self Adjoint Solver is faster than Spectra SymGEigSolver (tested up to n = 18)).

@codecov
Copy link

codecov bot commented Jul 16, 2022

Codecov Report

Merging #233 (8a38e51) into develop (774abdb) will increase coverage by 0.63%.
The diff coverage is 65.40%.

❗ Current head 8a38e51 differs from pull request most recent head 04d53af. Consider uploading reports for the commit 04d53af to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #233      +/-   ##
===========================================
+ Coverage    53.58%   54.22%   +0.63%     
===========================================
  Files          101       97       -4     
  Lines         5931     5791     -140     
  Branches      2766     2679      -87     
===========================================
- Hits          3178     3140      -38     
- Misses         967     1028      +61     
+ Partials      1786     1623     -163     
Impacted Files Coverage Δ
include/random_walks/uniform_billiard_walk.hpp 63.63% <ø> (-1.52%) ⬇️
include/convex_bodies/spectrahedra/spectrahedron.h 8.33% <20.00%> (+8.33%) ⬆️
...relation_matrices/correlation_spectrahedron_MT.hpp 50.00% <50.00%> (ø)
...correlation_matrices/correlation_spectrahedron.hpp 66.23% <66.23%> (ø)
include/matrix_operations/EigenvaluesProblems.h 32.43% <66.66%> (+32.43%) ⬆️
...onvex_bodies/correlation_matrices/corre_matrix.hpp 69.04% <69.04%> (ø)
include/sampling/sample_correlation_matrices.hpp 71.42% <71.42%> (ø)
include/sampling/sphere.hpp 84.21% <78.57%> (-15.79%) ⬇️
include/cartesian_geom/point.h 62.00% <100.00%> (+1.79%) ⬆️
include/random_walks/compute_diameter.hpp 40.98% <100.00%> (+8.25%) ⬆️
... and 28 more

@huuphuocle huuphuocle closed this Jul 16, 2022
@huuphuocle huuphuocle reopened this Jul 16, 2022
Copy link
Member

@vissarion vissarion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! I have a few comments.

.gitignore Outdated Show resolved Hide resolved
examples/correlation_matrices/CMakeLists.txt Outdated Show resolved Hide resolved
include/random_walks/uniform_rdhr_walk.hpp Outdated Show resolved Hide resolved
include/sampling/random_point_generators.hpp Outdated Show resolved Hide resolved
include/sampling/sample_correlation_matrices.hpp Outdated Show resolved Hide resolved
include/sampling/sample_correlation_matrices.hpp Outdated Show resolved Hide resolved
test/CMakeLists.txt Show resolved Hide resolved
@vissarion
Copy link
Member

Thanks for addressing the comments. Please fix some conflicts and merge with current develop to let the tests run. Then this PR could be merged!

@vissarion vissarion merged commit 130a2df into GeomScale:develop Nov 2, 2022
TolisChal pushed a commit that referenced this pull request Jul 7, 2024
* first commit

* draft

* draft

* update some code

* finish Point_matrix.cpp

* change name: CorreSpectra.cpp

* update

* TODO

* change TODO

* update

* update

* update

* update

* clean

* update

* correlation class

* billiard walk

* eigenvaluescorrelation.h

* update

* update

* update

* update

* update

* update

* faster billiard walk

* add missing CMake file

* start hmc

* add old sampler file

* Revert "add old sampler file"

This reverts commit 1b2f299.

* Revert "start hmc"

This reverts commit 642d4e1.

* revert commits of HMC walk

* clean unecessary code and fix minor changes

* New class CorreSpectra inherits from Spectrahedron

* add first code of ReHMC with leap frog for Gaussian sampling for testing

* relocate files:

* sample_correlation_matrices.hpp -> sampling/

* test.hpp -> test/sampling_correlation_matrices_test.cpp

* ReHMC.cpp -> random_walks/gaussian_ReHMC_correlation.hpp

* move test files to test folder and add more test

* change ReHMC code to WalkType class to suit volesti

* move content of EigenvaluesCorrelation to EigenvaluesProblems

remove temporary HCM walk

change Walk Length of test to 1

* simplify code of corre_spectra.hpp

* new correlation matrix class : CorreSpectra2 (testing: run for n=3, bug for n=10)

* fix bugs of CorreSpectra2 for BilliardWalk

* add some more tests + optimize reflection of CorreSpectra2

* fix some bugs of Spectrahedra to run BallWalk and AcceleratedBilliardWalk

* New changes:

* Change name of CorreSpectr2 -> CorreSpectra_MT

* Added and tested BallWalk for CorreSpectra_MT

* Compute diameter: remove NT(6)

* Remove commented code

* remove redundant comments

* add examples for sampling correlation matrices and remove redundant functions in tests

* added RDHR walk + fixed small changes

* remove redundant files in examples

* update CMakeLists in examples to enable MKL

* change MKL linking in examples' CMakeLists.txt

* change const specifier in several functions + readded const for Polytope arguments in functions of uniform_ball_walk.hpp

* add const specifier to is_in in spectrahedron class (required for Ball Walk)

* newline end of gitignore

* add copyright to examples

* format uniform_billiard_walk.hpp (indent, trailing spaces,...)

* change header guards of convex_bodies correlation_matrices files

* fix bugs in Spectrahedron line_intersect (wrong sign of negative distance) and change order of vector coefficients of CorreSpectra to lower triangular part (to homogenize with CorreSpectra_MT)

* homogenize check_output in tests for CorreSpectra and CorreSpectra_MT

* change names of CorreSpectra classes to CorrelationSpectrahedron

* change include path of CorrelationSpectrahedron in random walks

* format and optimize (minor) sampling/sphere.hpp

* add Copyright headers

* format style corre_matrix.hpp

* format style CorrelationSpectrahedron

* format style CorrelationSpectrahedron classes

* move direct (old) sampling functions to examples and remove tests for those functions in test file

* remove old tests from CMakeLists.txt

* add const keywords back to RDHR Walk

* fix bugs in corre_matrix

* add const keyword back to gaussian random point generator

Co-authored-by: phuoc <huu-phuoc.le@lip6.fr>
Co-authored-by: Vissarion Fisikopoulos <fisikop@gmail.com>
TolisChal pushed a commit that referenced this pull request Jul 7, 2024
* first commit

* draft

* draft

* update some code

* finish Point_matrix.cpp

* change name: CorreSpectra.cpp

* update

* TODO

* change TODO

* update

* update

* update

* update

* clean

* update

* correlation class

* billiard walk

* eigenvaluescorrelation.h

* update

* update

* update

* update

* update

* update

* faster billiard walk

* add missing CMake file

* start hmc

* add old sampler file

* Revert "add old sampler file"

This reverts commit 1b2f299.

* Revert "start hmc"

This reverts commit 642d4e1.

* revert commits of HMC walk

* clean unecessary code and fix minor changes

* New class CorreSpectra inherits from Spectrahedron

* add first code of ReHMC with leap frog for Gaussian sampling for testing

* relocate files:

* sample_correlation_matrices.hpp -> sampling/

* test.hpp -> test/sampling_correlation_matrices_test.cpp

* ReHMC.cpp -> random_walks/gaussian_ReHMC_correlation.hpp

* move test files to test folder and add more test

* change ReHMC code to WalkType class to suit volesti

* move content of EigenvaluesCorrelation to EigenvaluesProblems

remove temporary HCM walk

change Walk Length of test to 1

* simplify code of corre_spectra.hpp

* new correlation matrix class : CorreSpectra2 (testing: run for n=3, bug for n=10)

* fix bugs of CorreSpectra2 for BilliardWalk

* add some more tests + optimize reflection of CorreSpectra2

* fix some bugs of Spectrahedra to run BallWalk and AcceleratedBilliardWalk

* New changes:

* Change name of CorreSpectr2 -> CorreSpectra_MT

* Added and tested BallWalk for CorreSpectra_MT

* Compute diameter: remove NT(6)

* Remove commented code

* remove redundant comments

* add examples for sampling correlation matrices and remove redundant functions in tests

* added RDHR walk + fixed small changes

* remove redundant files in examples

* update CMakeLists in examples to enable MKL

* change MKL linking in examples' CMakeLists.txt

* change const specifier in several functions + readded const for Polytope arguments in functions of uniform_ball_walk.hpp

* add const specifier to is_in in spectrahedron class (required for Ball Walk)

* newline end of gitignore

* add copyright to examples

* format uniform_billiard_walk.hpp (indent, trailing spaces,...)

* change header guards of convex_bodies correlation_matrices files

* fix bugs in Spectrahedron line_intersect (wrong sign of negative distance) and change order of vector coefficients of CorreSpectra to lower triangular part (to homogenize with CorreSpectra_MT)

* homogenize check_output in tests for CorreSpectra and CorreSpectra_MT

* change names of CorreSpectra classes to CorrelationSpectrahedron

* change include path of CorrelationSpectrahedron in random walks

* format and optimize (minor) sampling/sphere.hpp

* add Copyright headers

* format style corre_matrix.hpp

* format style CorrelationSpectrahedron

* format style CorrelationSpectrahedron classes

* move direct (old) sampling functions to examples and remove tests for those functions in test file

* remove old tests from CMakeLists.txt

* add const keywords back to RDHR Walk

* fix bugs in corre_matrix

* add const keyword back to gaussian random point generator

Co-authored-by: phuoc <huu-phuoc.le@lip6.fr>
Co-authored-by: Vissarion Fisikopoulos <fisikop@gmail.com>
TolisChal pushed a commit to TolisChal/volume_approximation that referenced this pull request Jul 7, 2024
* first commit

* draft

* draft

* update some code

* finish Point_matrix.cpp

* change name: CorreSpectra.cpp

* update

* TODO

* change TODO

* update

* update

* update

* update

* clean

* update

* correlation class

* billiard walk

* eigenvaluescorrelation.h

* update

* update

* update

* update

* update

* update

* faster billiard walk

* add missing CMake file

* start hmc

* add old sampler file

* Revert "add old sampler file"

This reverts commit 1b2f299.

* Revert "start hmc"

This reverts commit 642d4e1.

* revert commits of HMC walk

* clean unecessary code and fix minor changes

* New class CorreSpectra inherits from Spectrahedron

* add first code of ReHMC with leap frog for Gaussian sampling for testing

* relocate files:

* sample_correlation_matrices.hpp -> sampling/

* test.hpp -> test/sampling_correlation_matrices_test.cpp

* ReHMC.cpp -> random_walks/gaussian_ReHMC_correlation.hpp

* move test files to test folder and add more test

* change ReHMC code to WalkType class to suit volesti

* move content of EigenvaluesCorrelation to EigenvaluesProblems

remove temporary HCM walk

change Walk Length of test to 1

* simplify code of corre_spectra.hpp

* new correlation matrix class : CorreSpectra2 (testing: run for n=3, bug for n=10)

* fix bugs of CorreSpectra2 for BilliardWalk

* add some more tests + optimize reflection of CorreSpectra2

* fix some bugs of Spectrahedra to run BallWalk and AcceleratedBilliardWalk

* New changes:

* Change name of CorreSpectr2 -> CorreSpectra_MT

* Added and tested BallWalk for CorreSpectra_MT

* Compute diameter: remove NT(6)

* Remove commented code

* remove redundant comments

* add examples for sampling correlation matrices and remove redundant functions in tests

* added RDHR walk + fixed small changes

* remove redundant files in examples

* update CMakeLists in examples to enable MKL

* change MKL linking in examples' CMakeLists.txt

* change const specifier in several functions + readded const for Polytope arguments in functions of uniform_ball_walk.hpp

* add const specifier to is_in in spectrahedron class (required for Ball Walk)

* newline end of gitignore

* add copyright to examples

* format uniform_billiard_walk.hpp (indent, trailing spaces,...)

* change header guards of convex_bodies correlation_matrices files

* fix bugs in Spectrahedron line_intersect (wrong sign of negative distance) and change order of vector coefficients of CorreSpectra to lower triangular part (to homogenize with CorreSpectra_MT)

* homogenize check_output in tests for CorreSpectra and CorreSpectra_MT

* change names of CorreSpectra classes to CorrelationSpectrahedron

* change include path of CorrelationSpectrahedron in random walks

* format and optimize (minor) sampling/sphere.hpp

* add Copyright headers

* format style corre_matrix.hpp

* format style CorrelationSpectrahedron

* format style CorrelationSpectrahedron classes

* move direct (old) sampling functions to examples and remove tests for those functions in test file

* remove old tests from CMakeLists.txt

* add const keywords back to RDHR Walk

* fix bugs in corre_matrix

* add const keyword back to gaussian random point generator

Co-authored-by: phuoc <huu-phuoc.le@lip6.fr>
Co-authored-by: Vissarion Fisikopoulos <fisikop@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants