Skip to main content

Clifford and Geometric Algebra with TensorFlow

Project description

TFGA - TensorFlow Geometric Algebra

Build status PyPI

GitHub | Docs

Python package for Geometric / Clifford Algebra with TensorFlow 2.

This project is a work in progress. Its API may change and the examples aren't polished yet. Pull requests and suggestions either by opening an issue or by sending me an email are welcome.

Installation

Install using pip: pip install tfga

Requirements:

  • Python 3
  • tensorflow 2
  • numpy

Basic usage

from tfga import GeometricAlgebra

# Create an algebra with 3 basis vectors given their metric.
# Used to create MultiVector instances.
ga = GeometricAlgebra(metric=[1, 1, 1])

# 1 e_0 + 1 e_1 + 1 e_2
ordinary_vector = ga.ones(batch_shape=[], kind="vector")

# 5 + 5 e_01 + 5 e_02 + 5 e_12
quaternion = ga.fill(batch_shape=[], fill_value=5.0, kind="even")

# 5 + 1 e_0 + 1 e_1 + 1 e_2 + 5 e_01 + 5 e_02 + 5 e_12
multivector = ordinary_vector + quaternion

# Inner product e_0 | 1 e_0 + 1 e_1 + 1 e_2 = 1
print(ga.basis_mvs[0] | ordinary_vector)

# Exterior product e_0 ^ e_1 = e_01
print(ga.basis_mvs[0] ^ ga.basis_mvs[1])

# Grade reversal ~(5 + 5 e_01 + 5 e_02 + 5 e_12)
# = 5 + 5 e_10 + 5 e_20 + 5 e_21
# = 5 - 5 e_01 - 5 e_02 - 5 e_12
print(~quaternion)

# tf.Tensor 5
print(quaternion.scalar)

# tf.Tensor -5 (ie. reversed sign of e_01 component)
print(quaternion.tensor("10"))

# MultiVector with only e_01: 5 e_01
print(quaternion["10"])

Notebooks

Generic examples

Quantum Electrodynamics using Geometric Algebra

Projective Geometric Algebra

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

tfga-0.1.8.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

tfga-0.1.8-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file tfga-0.1.8.tar.gz.

File metadata

  • Download URL: tfga-0.1.8.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for tfga-0.1.8.tar.gz
Algorithm Hash digest
SHA256 dc612cb45bb065f612cb6ec2054899e5b7e93227d564a692d3af27cc8673bdd3
MD5 f1a57d6b823d1b432558ccc6de28da00
BLAKE2b-256 cb24cacb0367e593824a465205fd8b4956f7eb738f7104d224c644de52b4a192

See more details on using hashes here.

File details

Details for the file tfga-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: tfga-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for tfga-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c367c05cd97e241e70de1b233138655babf583b800adedcc452e8734912fe5d8
MD5 05e68da72099923a3ca32515f2b85b3b
BLAKE2b-256 c17492f6595784b457ffcb4906a2f516996cf77cce0bb91052b039fe3dffceb1

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