semvec/pypi-packages huggingface dataset:
necstar 0.1.1
A stabilizer decomposition based quantum circuit simulator implemented in Rust with Python bindings.
License: MIT
Requires Python: >=3.11

# NECSTAR: NEar-Clifford STAbilizer decomposition simulator in Rust (Python Bindings)

A high-performance quantum circuit simulator designed for the strong simulation of
near-Clifford circuits based on the stabilizer decomposition method.

NECSTAR is particularly effective for circuits dominated by Clifford gates
but also containing a small number of non-Clifford gates. Currently, NECSTAR supports
only T-gates as non-Clifford operations, but future versions may include additional
non-Clifford gates.

## Getting Started

You can install NECSTAR either via `pip` or by building from source.

### Install via pip (Recommended)
```bash
pip install necstar
```

*Note: Pre-built binaries are provided for major platforms. If a binary is not available for your system, the Rust toolchain is required to build from source.*

### Build from Source

Ensure you have the Rust toolchain installed. Then, clone the repository and build the Python package:

1. Clone the repository:

    ```bash
    git clone git@github.com:mutekichi/necstar.git
    cd necstar
    ```

2. (recommended) Create and activate a virtual environment:

    ```bash
    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    ```

3. Build and install the package:

    ```bash
    pip install -e .
    ```

    Since NECSTAR uses `maturin` as its build backend, `pip` will automatically handle the Rust compilation. This requires that you have the Rust toolchain installed on your system.


## Example Usage

```python
import necstar

# 1. Build a quantum circuit
qc = necstar.QuantumCircuit(2)
qc.apply_h(0)
qc.apply_cx(0, 1)
qc.apply_t(1) # Non-Clifford T-gate

# 2. Compile into a QuantumState (internally decomposes T-states)
state = necstar.QuantumState.from_circuit(qc)

# 3. Perform operations
shots = 1024
samples = state.sample(qargs=[0, 1], shots=shots)
print(f"Samples: {samples}")

pauli_z0 = necstar.PauliString.from_str("ZI")
exp_val = state.exp_value(pauli_z0)
print(f"Expectation value: {exp_val}")

# (Optional) Check the stabilizer rank
print(f"Stabilizer rank: {state.stabilizer_rank}")
```

## Documentation
See the [Documentation](https://mutekichi.github.io/necstar/) for more details and examples.
torchopviz 0.1.3
A small package to create visualizations of PyTorch operation execution
License: MIT
Requires Python: >=3.9

TorchOpViz
=======

A small package to create visualizations of PyTorch operation execution.

## Install

Install PyTorch with CUDA support like:

```
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu126
```

Required torch>=2.1.0.

Install torchopviz:

```
pip3 install torchopviz
```

## Usage

Offline mode:

```
"""
complex_graph.json is a list of tensors, torch operations and modules. Each element consist of: 
    id                  identity number for tensors and torch operations
    start_time          start timestamp(us)
    end_time            end timestamp(us)
    is_tensor           True for tensor
    is_leaf             True for tensor and torch operation
    label               module name/torch operation name/tensor shape
    parent              parent of torch op
    children            a children list of module, used to build trees of modules and torch ops
    next_nodes          a list of next nodes id, used to build graphs of tensors and torch ops
    info                lifetime, and metadata for tensors
You can generate your json file which can be displayed by "torchopviz".
"""
from torchopviz import offline_viz
offline_viz(file="./complex_graph.json")
```

Online mode:

```
import torch
from torch import nn
from torchopviz import online_viz
model = nn.Sequential()
model.add_module('W0', nn.Linear(8, 16))
model.add_module('tanh', nn.Tanh())
model.add_module('W1', nn.Linear(16, 1))
data = torch.randn(1,8)
online_viz(model, data, save_dir="./sample_data")
```

![example](example.png)

## TODO

1.Display distributed computation

2.Combine memory usage info