Exact numerical simulation#30
Draft
BrendanKKrueger wants to merge 5 commits into
Draft
Conversation
9 tasks
- Add eigendecomposition_analysis() function in analysis.py - Support full and partial eigendecomposition modes - Add configuration fields: num_eigenvalues, eigendecomposition_matrices, which_eigenvalues - Support 'smallest', 'largest', and 'both' eigenvalue selection - Add save_eigendecomposition() and load_eigendecomposition() to file_io.py - Add 19 comprehensive tests in test_eigendecomposition.py - Update README.md with eigendecomposition documentation - Update config_full_analysis.py with eigendecomposition examples - All 200 tests passing (128 original + 53 Branch 1 + 19 Branch 2)
- Add error_analysis() function in analysis.py (~350 lines) - Three independent error types: 1. Eigenvalue errors: Compare k smallest eigenvalues 2. Matrix norm errors: Frobenius and spectral norms 3. State-dependent errors: Apply operators to specific states - Add configuration fields: error_num_eigenvalues, error_matrix_norms, error_state_inputs - Support matrix-free computation for large systems - Matrix norm computation with progress tracking - Add 18 comprehensive tests in test_error_analysis.py - Update README.md with error analysis documentation - Update config_full_analysis.py with error analysis examples - All 218 tests passing (128 original + 53 Branch 1 + 19 Branch 2 + 18 Branch 3)
- Add eigendecomposition_analysis() function in analysis.py - Support full and partial eigendecomposition modes - Add configuration fields: num_eigenvalues, eigendecomposition_matrices, which_eigenvalues - Support 'smallest', 'largest', and 'both' eigenvalue selection - Add save_eigendecomposition() and load_eigendecomposition() to file_io.py - Add 19 comprehensive tests in test_eigendecomposition.py - Update README.md with eigendecomposition documentation - Update config_full_analysis.py with eigendecomposition examples - All 200 tests passing (128 original + 53 Branch 1 + 19 Branch 2)
- Add error_analysis() function in analysis.py (~350 lines) - Three independent error types: 1. Eigenvalue errors: Compare k smallest eigenvalues 2. Matrix norm errors: Frobenius and spectral norms 3. State-dependent errors: Apply operators to specific states - Add configuration fields: error_num_eigenvalues, error_matrix_norms, error_state_inputs - Support matrix-free computation for large systems - Matrix norm computation with progress tracking - Add 18 comprehensive tests in test_error_analysis.py - Update README.md with error analysis documentation - Update config_full_analysis.py with error analysis examples - All 218 tests passing (128 original + 53 Branch 1 + 19 Branch 2 + 18 Branch 3)
- Add exact_numerical_simulation() function in analysis.py (~90 lines) - Uses exact Hamiltonian matrix instead of approximate unitary - Output files: input_exact_final.npy (distinguishes from input_final.npy) - Works with both dense matrices and matrix-free operators - Add configuration field: exact_simulation_inputs - Add 13 comprehensive tests in test_exact_simulation.py - Update README.md with exact simulation documentation - Update config_full_analysis.py with exact simulation examples - All 231 tests passing (128 original + 53 Branch 1 + 19 Branch 2 + 18 Branch 3 + 13 Branch 4) Completes 5-branch implementation plan for exact matrix analysis and error metrics.
4871b3a to
0b920b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #29
Step 4 of #25
Summary from Claude below
Branch 4: Exact Numerical Simulation
Title
Branch 4: Add exact numerical simulation (completes exact matrix analysis implementation)
Description
Overview
This PR implements exact numerical simulation using the exact Hamiltonian matrix (without Trotter or other approximations). This is Branch 4, the final branch in a 5-branch implementation plan to add comprehensive exact matrix analysis and error quantification capabilities to QHAT.
Purpose
Changes Made
Modified Files:
analysis/config_types.pyexact_simulation_inputsfield (default: None, disabled)analysis/analysis.pyexact_numerical_simulation()function (~90 lines)numerical_simulation()input_exact_final.npy(vsinput_final.npyfor approximate)matvec()method for matrix-free operatorsanalyze_algorithm()to:analysis/README.mdanalysis/examples/config_full_analysis.pyNew Files:
analysis/tests/test_exact_simulation.py(477 lines)Technical Details
Exact Simulation Function:
Key features:
matvec()if available, otherwise@operator_exact_finalsuffix distinguishes from_final(approximate)_compute_exact_matrix()Comparison workflow:
Users can run both simulations on the same input:
Scaling:
Type of Change
Testing
Test Coverage:
Test Highlights:
_exact_final)Running Tests:
Usage Example
Output:
input_exact_final.npyfor each inputContext: Implementation Plan
This is Branch 4, the final branch in a 5-branch sequence:
All branches deliver independent, testable functionality. The full pipeline is now complete.
Benefits
For Users:
For Developers:
numerical_simulation()structure (easy to understand)For the Project:
Performance
Scaling:
Memory:
Comparison with approximate simulation:
Checklist
Merge Dependencies
bkk_error_metrics(Branch 3)mainCommits
4871b3a: Branch 4: Add exact numerical simulationRelated Issues
Completes the effort to add exact matrix analysis and error quantification capabilities to QHAT for validating algorithm accuracy.
This is the final branch in the 5-branch implementation plan.
Reviewers
@lanl/qhat-team
Notes for Reviewers
Key files to review:
analysis/analysis.py: Newexact_numerical_simulation()function (~90 lines)numerical_simulation()but uses exact matrix_exact_finalsuffixanalysis/config_types.py: Newexact_simulation_inputsfieldDesign decisions to consider:
_exact_finalvs_final) distinguishes exact from approximatenumerical_simulation()structure for consistencyIntegration with previous branches:
_compute_exact_matrix()Testing:
Implementation completeness:
Future possibilities (not in scope):
Summary
This PR completes the 5-branch implementation plan by adding exact numerical simulation. Users can now:
The complete pipeline enables comprehensive validation of quantum algorithms in QHAT.