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.
src/- Main source codeQuantumOpticsBase.jl- Main module filebases.jl- Different quantum bases (Fock, Spin, NLevel, etc.)states.jl- Quantum state implementationsoperators*.jl- Various operator implementations (dense, sparse, lazy)metrics.jl- Distance metrics and measurementsphasespace.jl- Phase space functionstransformations.jl- Basis transformations
test/- Comprehensive test suitedocs/- Documentation source files
# Run all tests
julia --project=. -e "using Pkg; Pkg.test()"
# Run with only specific GPU backend tests
CUDA_TEST=true julia --project=. -e "using Pkg; Pkg.test()"
AMDGPU_TEST=true julia --project=. -e "using Pkg; Pkg.test()"
OpenCL_TEST=true julia --project=. -e "using Pkg; Pkg.test()"# Install documentation dependencies
julia --project=docs -e "using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()"
# Build documentation
julia --project=docs docs/make.jl# Instantiate project dependencies
julia --project=. -e "using Pkg; Pkg.instantiate()"
# Update dependencies
julia --project=. -e "using Pkg; Pkg.update()"
# Check package status
julia --project=. -e "using Pkg; Pkg.status()"The test suite uses TestItemRunner and includes:
- Unit tests for all quantum bases (Fock, Spin, NLevel, Charge, Particle)
- Operator tests (dense, sparse, lazy implementations)
- State manipulation and transformation tests
- Metrics and measurement tests
- Integration tests with other quantum packages
- Code quality tests (Aqua.jl, JET.jl, doctests)
Special test configurations:
- JET tests run when
JET_TEST=trueenvironment variable is set - Aqua and doctest checks require Julia 1.10+
QuantumInterface.jl- Provides common quantum computing interfacesLinearAlgebra- Core linear algebra operationsSparseArrays- Sparse matrix implementationsFFTW- Fast Fourier transforms for phase space calculationsFastExpm- Efficient matrix exponentials
- Minimum Julia version: 1.10
- Uses semantic versioning
- Extensive test coverage with multiple CI platforms
- Documentation auto-deploys on releases
- Compatible with GPU acceleration through Adapt.jl (converting main memory arrays to GPU arrays)
QuantumOptics.jl- Main package that builds on this baseQuantumInterface.jl- Common interfaces- See the @qojulia organization for the full ecosystem
Before committing, ensure there are no trailing whitespaces in Julia files. Do not format files that are not part of the specific feature under development.
# Remove trailing whitespaces from all .jl files (requires gnu tools)
find . -type f -name '*.jl' -exec sed --in-place 's/[[:space:]]\+$//' {} \+Ensure all Julia files end with a newline to avoid misbehaving CLI tools. Do not format files that are not part of the specific feature under development.
# Add newline to end of all .jl files that don't have one
find . -type f -name '*.jl' -exec sed -i '$a\' {} \+- Use 4 spaces for indentation (no tabs)
- Remove trailing whitespaces from all lines
- Ensure files end with a single newline
- Follow Julia standard naming conventions
- Keep lines under 100 characters when reasonable
This package follows standard Julia development practices:
- Always pull latest changes first: Before creating any new feature or starting work, ensure you have the latest version by running
git pull origin master(orgit pull origin main) - Pull before continuing work: Other maintainers might have modified the branch you are working on. Always call
git pullbefore continuing work on an existing branch - Push changes to remote: Always push your local changes to the remote branch to keep the PR up to date:
git push origin <branch-name> - Run all tests before submitting: Before creating or updating a PR, always run the full test suite to ensure nothing is broken:
julia --project=. -e "using Pkg; Pkg.test()" - Fork and create feature branches
- Write tests for new functionality
- Ensure documentation builds successfully
- Follow code formatting guidelines above
- All tests must pass before merging
- Keep PRs focused: A PR should implement one self-contained change. Avoid mixing feature work with formatting changes to unrelated files, even for improvements like adding missing newlines. Format unrelated files in separate commits or PRs.