# jacky09299/qutip architecture

> Architecture diagram of the GitHub repository jacky09299/qutip, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jacky09299/qutip
- Repository: https://github.com/jacky09299/qutip

## Overview

##### Project type and purpose
- QuTiP is an open-source Python library/tool for simulating closed and open quantum systems.
- It exposes a high-level Python API for building quantum objects, running solvers, performing analyses, and visualizing results.
- Under the hood, it leverages Numpy, Scipy, Cython (and optional MKL) for numerical backends, and Matplotlib for plotting.

##### File structure
- Top-level packaging:
– setup.py / pyproject.toml / setup.cfg – packaging and build configuration
– qutip/ – core Python package
– requirements.txt – external dependencies
– doc/ – full user and developer documentation
– qutip/tests/ – extensive unit and integration test suite
- Inside qutip/:
– core/ – basic quantum data structures (Qobj), tensor operations, environments
– core/data/ – memory‐efficient low-level data operators, implemented in Cython + C++
– solver/ – time evolution, Monte Carlo, steady state, HEOM, SDE, etc. It’s modular and plugin-friendly.
– piqs/, qip/, tomography/, measurement.py, etc. – domain-specific modules built on the core
– visualization.py, animation.py, bloch.py – plotting helpers
– _mkl/ – optional Intel MKL wrappers for sparse/dense solvers
– ui/ – user interface utilities (progress bars)
– fileio.py – serialization and export

##### README for additional insights
- Confirms Python + Cython + Numpy/Scipy backends, Matplotlib for graphics
- Mentions extensibility, broad solver coverage, optional backend dependencies
- CI via GitHub Actions, documentation via ReadTheDocs

##### Elements
- Clear labels for each component (e.g., “API Layer,” “Dense Cython Backend,” “mesolve Solver”)
– Blue for Python layers,
– Green for Cython/C++ backends,
– Orange for external dependencies,
– Gray for CI/docs pipelines

## Diagram (Mermaid)

```mermaid
graph TB
    %% User Layer
    User["User Scripts / Notebooks"]:::python

    %% API Layer
    subgraph "API Layer"
        APIInit["__init__.py"]:::python
        About["about.py"]:::python
        Cite["cite.py"]:::python
    end

    %% Core Computation Layer
    subgraph "Core Computation Layer"
        subgraph "Python Core Modules"
            Qobj["qobj.py"]:::python
            Ops["operators.py"]:::python
            Tensor["tensor.py"]:::python
            Env["environment.py"]:::python
            Dim["dimensions.py"]:::python
        end
        subgraph "Cython/C++ Backends"
            CyDir["cy/"]:::cython
            DataDir["data/"]:::cython
        end
    end

    %% Solver Layer
    subgraph "Solver Layer"
        Mes["mesolve.py"]:::python
        Mc["mcsolve.py"]:::python
        Se["sesolve.py"]:::python
        Ss["steadystate.py"]:::python
        Res["result.py"]:::python
        subgraph "Integrators"
            IntDir["integrator/"]:::python
        end
        subgraph "HEOM"
            HeomDir["heom/"]:::python
        end
        subgraph "Non-Markovian"
            NonDir["nonmarkov/"]:::python
        end
        subgraph "Stochastic SDE"
            SodeDir["sode/"]:::python
        end
    end

    %% Domain-specific Modules
    subgraph "Domain-specific Modules"
        PIQS["_piqs.pyx / piqs.py"]:::python
        Qip["qip.py"]:::python
        Tomo["tomography.py"]:::python
        Meas["measurement.py"]:::python
    end

    %% Output Layer
    subgraph "Output Layer"
        Vis["visualization.py"]:::python
        Anim["animation.py"]:::python
        Bloch["bloch.py"]:::python
        MPL["matplotlib_utilities.py"]:::python
        FileIO["fileio.py"]:::python
    end

    %% UI Utilities
    UI["progressbar.py"]:::python

    %% External Dependencies
    subgraph "External Dependencies"
        NP["Numpy"]:::external
        SP["Scipy"]:::external
        MPLib["Matplotlib"]:::external
        CythonExt["Cython"]:::external
        MKLDep["Intel MKL"]:::external
        MKLBack1["spmv.py"]:::cython
        MKLBack2["spsolve.py"]:::cython
    end

    %% CI/CD & Documentation
    subgraph "CI/CD & Documentation"
        GitHub["GitHub Actions"]:::external
        Readthedocs["ReadTheDocs"]:::external
        DocGen["doc/"]:::external
        Tests["qutip/tests/"]:::external
    end

    %% Connections
    User --> APIInit
    APIInit --> About
    APIInit --> Cite
    APIInit --> Qobj
    About --> Qobj
    Cite --> Qobj

    Qobj --> Mes
    Ops --> Mes
    Tensor --> Mes
    Env --> Mes
    Dim --> Mes
    DataDir --> Mes
    CyDir --> Mes

    Mes --> Res
    Mc --> Res
    Se --> Res
    Ss --> Res

    Res --> Vis
    Res --> FileIO

    IntDir --> Mes
    HeomDir --> Mes
    NonDir --> Mes
    SodeDir --> Mes

    Qobj --> PIQS
    DataDir --> PIQS
    Qobj --> Qip
    Qobj --> Tomo
    Qobj --> Meas

    PIQS --> Vis
    Qip --> Vis
    Tomo --> Vis
    Meas --> Vis

    Qobj --> UI

    NP --> CyDir
    SP --> CyDir
    CythonExt --> CyDir
    MKLDep --> MKLBack1
    MKLDep --> MKLBack2
    MKLBack1 --> DataDir
    MKLBack2 --> DataDir

    MPLib --> Vis

    GitHub --> Tests
    GitHub --> DocGen
    Readthedocs --> DocGen

    %% Click Events
    click APIInit "https://github.com/jacky09299/qutip/blob/master/qutip/__init__.py"
    click About "https://github.com/jacky09299/qutip/blob/master/qutip/about.py"
    click Cite "https://github.com/jacky09299/qutip/blob/master/qutip/cite.py"
    click Qobj "https://github.com/jacky09299/qutip/blob/master/qutip/core/qobj.py"
    click Ops "https://github.com/jacky09299/qutip/blob/master/qutip/core/operators.py"
    click Tensor "https://github.com/jacky09299/qutip/blob/master/qutip/core/tensor.py"
    click Env "https://github.com/jacky09299/qutip/blob/master/qutip/core/environment.py"
    click Dim "https://github.com/jacky09299/qutip/blob/master/qutip/core/dimensions.py"
    click CyDir "https://github.com/jacky09299/qutip/tree/master/qutip/core/cy/"
    click DataDir "https://github.com/jacky09299/qutip/tree/master/qutip/core/data/"
    click Mes "https://github.com/jacky09299/qutip/blob/master/qutip/solver/mesolve.py"
    click Mc "https://github.com/jacky09299/qutip/blob/master/qutip/solver/mcsolve.py"
    click Se "https://github.com/jacky09299/qutip/blob/master/qutip/solver/sesolve.py"
    click Ss "https://github.com/jacky09299/qutip/blob/master/qutip/solver/steadystate.py"
    click Res "https://github.com/jacky09299/qutip/blob/master/qutip/solver/result.py"
    click IntDir "https://github.com/jacky09299/qutip/tree/master/qutip/solver/integrator/"
    click HeomDir "https://github.com/jacky09299/qutip/tree/master/qutip/solver/heom/"
    click NonDir "https://github.com/jacky09299/qutip/tree/master/qutip/solver/nonmarkov/"
    click SodeDir "https://github.com/jacky09299/qutip/tree/master/qutip/solver/sode/"
    click PIQS "https://github.com/jacky09299/qutip/tree/master/qutip/piqs/"
    click Qip "https://github.com/jacky09299/qutip/blob/master/qutip/qip.py"
    click Tomo "https://github.com/jacky09299/qutip/blob/master/qutip/tomography.py"
    click Meas "https://github.com/jacky09299/qutip/blob/master/qutip/measurement.py"
    click Vis "https://github.com/jacky09299/qutip/blob/master/qutip/visualization.py"
    click Anim "https://github.com/jacky09299/qutip/blob/master/qutip/animation.py"
    click Bloch "https://github.com/jacky09299/qutip/blob/master/qutip/bloch.py"
    click MPL "https://github.com/jacky09299/qutip/blob/master/qutip/matplotlib_utilities.py"
    click FileIO "https://github.com/jacky09299/qutip/blob/master/qutip/fileio.py"
    click UI "https://github.com/jacky09299/qutip/blob/master/qutip/ui/progressbar.py"
    click MKLBack1 "https://github.com/jacky09299/qutip/blob/master/qutip/_mkl/spmv.py"
    click MKLBack2 "https://github.com/jacky09299/qutip/blob/master/qutip/_mkl/spsolve.py"

    %% Styles
    classDef python fill:#E0F7FA,stroke:#006064,stroke-width:1px
    classDef cython fill:#E8F5E9,stroke:#1B5E20,stroke-width:1px
    classDef external fill:#FFF3E0,stroke:#E65100,stroke-width:1px
```
