|
| 1 | +# QuantumOpticsBase.jl |
| 2 | + |
| 3 | +QuantumOpticsBase.jl provides the base functionality for QuantumOptics.jl. It implements fundamental types such as different bases, states and operators defined on these bases, and core operations (such as multiplication) on these states/operators. |
| 4 | + |
| 5 | +## Project Structure |
| 6 | + |
| 7 | +- `src/` - Main source code |
| 8 | + - `QuantumOpticsBase.jl` - Main module file |
| 9 | + - `bases.jl` - Different quantum bases (Fock, Spin, NLevel, etc.) |
| 10 | + - `states.jl` - Quantum state implementations |
| 11 | + - `operators*.jl` - Various operator implementations (dense, sparse, lazy) |
| 12 | + - `metrics.jl` - Distance metrics and measurements |
| 13 | + - `phasespace.jl` - Phase space functions |
| 14 | + - `transformations.jl` - Basis transformations |
| 15 | +- `test/` - Comprehensive test suite |
| 16 | +- `docs/` - Documentation source files |
| 17 | + |
| 18 | +## Development Commands |
| 19 | + |
| 20 | +### Running Tests |
| 21 | +```bash |
| 22 | +# Run all tests |
| 23 | +julia --project=. -e "using Pkg; Pkg.test()" |
| 24 | +``` |
| 25 | + |
| 26 | +### Building Documentation |
| 27 | +```bash |
| 28 | +# Install documentation dependencies |
| 29 | +julia --project=docs -e "using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()" |
| 30 | + |
| 31 | +# Build documentation |
| 32 | +julia --project=docs docs/make.jl |
| 33 | +``` |
| 34 | + |
| 35 | +### Package Management |
| 36 | +```bash |
| 37 | +# Instantiate project dependencies |
| 38 | +julia --project=. -e "using Pkg; Pkg.instantiate()" |
| 39 | + |
| 40 | +# Update dependencies |
| 41 | +julia --project=. -e "using Pkg; Pkg.update()" |
| 42 | + |
| 43 | +# Check package status |
| 44 | +julia --project=. -e "using Pkg; Pkg.status()" |
| 45 | +``` |
| 46 | + |
| 47 | +## Testing Information |
| 48 | + |
| 49 | +The test suite uses TestItemRunner and includes: |
| 50 | + |
| 51 | +- Unit tests for all quantum bases (Fock, Spin, NLevel, Charge, Particle) |
| 52 | +- Operator tests (dense, sparse, lazy implementations) |
| 53 | +- State manipulation and transformation tests |
| 54 | +- Metrics and measurement tests |
| 55 | +- Integration tests with other quantum packages |
| 56 | +- Code quality tests (Aqua.jl, JET.jl, doctests) |
| 57 | + |
| 58 | +Special test configurations: |
| 59 | +- JET tests run when `JET_TEST=true` environment variable is set |
| 60 | +- Aqua and doctest checks require Julia 1.10+ |
| 61 | + |
| 62 | +## Key Dependencies |
| 63 | + |
| 64 | +- `QuantumInterface.jl` - Provides common quantum computing interfaces |
| 65 | +- `LinearAlgebra` - Core linear algebra operations |
| 66 | +- `SparseArrays` - Sparse matrix implementations |
| 67 | +- `FFTW` - Fast Fourier transforms for phase space calculations |
| 68 | +- `FastExpm` - Efficient matrix exponentials |
| 69 | + |
| 70 | +## Development Notes |
| 71 | + |
| 72 | +- Minimum Julia version: 1.10 |
| 73 | +- Uses semantic versioning |
| 74 | +- Extensive test coverage with multiple CI platforms |
| 75 | +- Documentation auto-deploys on releases |
| 76 | +- Compatible with GPU acceleration through Adapt.jl (converting main memory arrays to GPU arrays) |
| 77 | + |
| 78 | +## Related Packages |
| 79 | + |
| 80 | +- `QuantumOptics.jl` - Main package that builds on this base |
| 81 | +- `QuantumInterface.jl` - Common interfaces |
| 82 | +- See the @qojulia organization for the full ecosystem |
| 83 | + |
| 84 | +## Code Formatting |
| 85 | + |
| 86 | +### Removing Trailing Whitespaces |
| 87 | +Before committing, ensure there are no trailing whitespaces in Julia files: |
| 88 | + |
| 89 | +```bash |
| 90 | +# Remove trailing whitespaces from all .jl files (requires gnu tools) |
| 91 | +find . -type f -name '*.jl' -exec sed --in-place 's/[[:space:]]\+$//' {} \+ |
| 92 | +``` |
| 93 | + |
| 94 | +### General Formatting Guidelines |
| 95 | +- Use 4 spaces for indentation (no tabs) |
| 96 | +- Remove trailing whitespaces from all lines |
| 97 | +- Ensure files end with a single newline |
| 98 | +- Follow Julia standard naming conventions |
| 99 | +- Keep lines under 100 characters when reasonable |
| 100 | + |
| 101 | +## Contributing |
| 102 | + |
| 103 | +This package follows standard Julia development practices: |
| 104 | +- Fork and create feature branches |
| 105 | +- Write tests for new functionality |
| 106 | +- Ensure documentation builds successfully |
| 107 | +- Follow code formatting guidelines above |
| 108 | +- All tests must pass before merging |
0 commit comments