A century-proof SI-vector physics engine for industrial inference.
Project description
PhysTensor
PhysTensor
A strictly-typed physical tensor library for deterministic scientific computing.
Overview
Scientific computing libraries excel at numerical operations but generally treat tensors as dimensionless arrays. This allows mathematically valid yet physically incorrect computations—for example, adding pressure to velocity or multiplying incompatible quantities without warning.
PhysTensor closes this gap by embedding physical dimensions and units directly into tensor operations. Every computation preserves dimensional information, enabling automatic validation of physical consistency while maintaining a familiar tensor programming experience.
Rather than replacing existing numerical backends, PhysTensor acts as a physics-aware layer that integrates dimensional analysis with modern tensor computation.
Why PhysTensor?
PhysTensor is designed around one principle:
A computation should be mathematically valid and physically meaningful.
The library combines:
- Strictly typed tensor objects
- Physical units and dimensions
- Automatic dimensional analysis
- Deterministic execution
- Backend-agnostic tensor computation
- Engineering-oriented validation
Features
Physics-Aware Tensors
Every tensor carries physical dimensional information alongside its numerical values.
Example quantities include:
- Length
- Time
- Mass
- Temperature
- Current
- Velocity
- Acceleration
- Force
- Pressure
- Energy
- Power
Automatic Dimensional Analysis
PhysTensor validates every operation.
Examples:
✅ Force × Distance → Energy
✅ Velocity × Time → Distance
❌ Pressure + Velocity
❌ Energy + Temperature
Invalid operations raise informative exceptions before incorrect results propagate through a scientific workflow.
Strict Typing
Designed for modern Python tooling.
- mypy
- pyright
- Ruff
- IDE autocompletion
Deterministic Scientific Computing
PhysTensor prioritizes reproducibility by ensuring computations produce consistent results across scientific and engineering workflows.
Backend Agnostic
PhysTensor is designed to integrate with existing numerical ecosystems rather than replace them.
Potential backends include:
- NumPy
- PyTorch
- JAX
Extensible Unit System
Define custom physical dimensions and derived quantities for specialized engineering domains.
Installation
pip install phystensor
For development:
git clone https://github.com/OWNER/phystensor.git
cd phystensor
pip install -e .[dev]
Quick Start
from phystensor import Tensor
from phystensor.units import Meter, Second
distance = Tensor([10], unit=Meter)
time = Tensor([2], unit=Second)
velocity = distance / time
print(velocity)
Output
5 m/s
Safety Example
pressure + velocity
Output
DimensionMismatchError:
Cannot add Pressure to Velocity.
Applications
PhysTensor is suitable for:
- Scientific computing
- Computational physics
- Physics-informed machine learning
- Digital twins
- Robotics
- Aerospace engineering
- Mechanical engineering
- Electrical engineering
- Renewable energy systems
- Battery modeling
- Industrial simulation
Architecture
User Application
│
┌───────▼────────┐
│ PhysTensor │
├────────────────┤
│ Typed Tensors │
│ Unit System │
│ Validation │
│ Dimensional │
│ Analysis │
└───────┬────────┘
│
┌───────────────┼────────────────┐
│ │ │
NumPy PyTorch JAX
Roadmap
Core
- Typed physical tensors
- Automatic dimensional analysis
- Unit propagation
Future
- Sparse tensors
- GPU acceleration
- Automatic differentiation
- Symbolic dimensions
- PDE utilities
- Finite element helpers
- Physics-informed optimization
Testing
pytest
Static analysis:
ruff check .
black --check .
mypy .
Contributing
Contributions are welcome.
Please:
- Fork the repository.
- Create a feature branch.
- Add tests.
- Ensure all CI checks pass.
- Submit a pull request.
Citation
If you use PhysTensor in research, please cite:
@software{phystensor,
title = {PhysTensor},
author = {Asif Kazi},
year = {2026},
url = {https://github.com/ksaad20/phystensor}
}
License
Released under the Apache License 2.0.
See the LICENSE file for details.
Vision
PhysTensor aims to provide a reliable foundation for physics-aware tensor computing, enabling researchers and engineers to write software that respects both mathematical correctness and physical laws.
PhysTensor
Tensor computing with physical meaning.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file phystensor-0.1.0.tar.gz.
File metadata
- Download URL: phystensor-0.1.0.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e558bd2f714079f894f62d26385862e3ea752f4d46e365e2d050200534a4e08
|
|
| MD5 |
6a4cc51af7ec63ef90a234977c23779a
|
|
| BLAKE2b-256 |
05758d0c84703492f9a02180777293e014fe127db0e48796e91499de5e618b2f
|
Provenance
The following attestation bundles were made for phystensor-0.1.0.tar.gz:
Publisher:
publish.yml on ksaad20/phystensor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
phystensor-0.1.0.tar.gz -
Subject digest:
6e558bd2f714079f894f62d26385862e3ea752f4d46e365e2d050200534a4e08 - Sigstore transparency entry: 2283928276
- Sigstore integration time:
-
Permalink:
ksaad20/phystensor@fd68e60bfdf5661953a66e7ecd37e0a1a11582c8 -
Branch / Tag:
refs/tags/v.0.0.1 - Owner: https://github.com/ksaad20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fd68e60bfdf5661953a66e7ecd37e0a1a11582c8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file phystensor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: phystensor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 38.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
874c4cf1c781d6b5c5fe67b2fee9752caaa97e02fa96f17d7d8900a4dd1a13f2
|
|
| MD5 |
c6ce6c5a3a55752c5b319144c81de8cf
|
|
| BLAKE2b-256 |
6d39083e30ce3902cd2e076bc5c651124209dcec9dc7c7ef12e91eda1b71b88e
|
Provenance
The following attestation bundles were made for phystensor-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ksaad20/phystensor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
phystensor-0.1.0-py3-none-any.whl -
Subject digest:
874c4cf1c781d6b5c5fe67b2fee9752caaa97e02fa96f17d7d8900a4dd1a13f2 - Sigstore transparency entry: 2283928584
- Sigstore integration time:
-
Permalink:
ksaad20/phystensor@fd68e60bfdf5661953a66e7ecd37e0a1a11582c8 -
Branch / Tag:
refs/tags/v.0.0.1 - Owner: https://github.com/ksaad20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fd68e60bfdf5661953a66e7ecd37e0a1a11582c8 -
Trigger Event:
release
-
Statement type: