Skip to main content

A PyTorch tensor extension for physical dimension-aware tensors.

Project description

phlower_tensor

Description

This library is separated from the main phlower library to provide tensor operations and utilities that can be used independently. It includes tensor objects which have physical dimensions, as well as various tensor operations such as addition, multiplication, contraction, and more.

Installation

You can install the library using pip:

pip install phlower-tensor

Usage

Here is a simple example of how to use the phlower_tensor library:

import torch
from phlower_tensor import phlower_tensor

# Create two tensors with physical dimensions
velocity = phlower_tensor(torch.rand(100, 3), dimension={"T": -1, "L": 1})
mass = phlower_tensor(torch.rand(100, 1), dimension={"M": 1})

kinetic_energy = 0.5 * mass * (velocity ** 2)
print(kinetic_energy.dimension)
# Output: PhlowerDimensionTensor(T: -2.0, L: 2.0, M: 1.0, I: 0.0, Theta: 0.0, N: 0.0, J: 0.0)

Physical dimensions are represented as dictionaries where keys are dimension symbols (e.g., "L" for length, "T" for time) and values are their respective exponents.

Symbol Dimension
L Length
T Time
M Mass
I Electric Current
Theta Temperature
N Amount of Substance
J Luminous Intensity

License

This project is licensed under the Apache-2.0 License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phlower_tensor-0.1.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phlower_tensor-0.1.0-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

File details

Details for the file phlower_tensor-0.1.0.tar.gz.

File metadata

  • Download URL: phlower_tensor-0.1.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for phlower_tensor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 382650aebf3a361a1a205cb99919006292d5636d04f430b40f485face4ef690a
MD5 b805623d5422e2e0786e3f2f01402714
BLAKE2b-256 47ed34aeb7574f79f08586047186a19974caca15ccd86bbc26dc8a0f83ec5fb1

See more details on using hashes here.

File details

Details for the file phlower_tensor-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: phlower_tensor-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for phlower_tensor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2e89f8b130770b57de48e4846de8e10a303bca443077edc728bafce70516fed
MD5 66c27ec814523cb01bd3f74330bbbdcb
BLAKE2b-256 8af00c700189af8afc3bd5d6b6ed46ba564a6fecfbe9323cc44389fcd8847524

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page