clifford-3-even

Crates.ioclifford-3-even
lib.rsclifford-3-even
version0.1.2
created_at2025-03-29 19:52:30.876508+00
updated_at2025-06-16 12:09:15.452435+00
descriptionA simple implementation of the even sub-algebra of 3-dimensional clifford algebra, specifically for qubit processing
homepage
repositoryhttps://github.com/absoludity/clifford-3-even
max_upload_size
id1611634
size56,681
Michael Nelson (absoludity)

documentation

README

Rotors - the even sub-algebra of the Clifford 3 dimensional algebra

A Rust implementation of simple rotors in the even sub-algebra of Cl(3).

What are Rotors?

Rotors are mathematical objects used to represent rotations in 3D space. Unlike matrices or quaternions, rotors arise naturally from the geometric product in Clifford Algebra.

A rotor is composed of a scalar part and three bivector components:

r = b_0 + b_x yz + b_y zx + b_z xy = b_0 + b_x Ix + b_y Iy + bz Iz

where:

  • b_0, b_x, b_y and b_z are scalar numbers,
  • x, y and z are orthogonal unit vectors (xx = yy = zz = 1), which anti-commute with each other (xy = -yx),
  • I is the vector product xyz, a pseudo-scalar (it commutes like a scalar). So Ix = xyzx = yz

Features

  • Create rotors from axis-angle representation
  • Perform rotor multiplication, addition, subtraction, and division
  • Normalize rotors
  • Calculate the reverse of a rotor
  • Apply rotations using the sandwich product (r * v * r.reverse())
  • The library exports 3 consts, Ix, Iy and Iz, for convenience.

Usage

use clifford_3_even::Rotor;

// Create a rotor representing a rotation around the x-axis by π/4 radians
let r = Rotor::from_axis_angle([1.0, 0.0, 0.0], std::f64::consts::FRAC_PI_4);

// When applied using the sandwich product, this will rotate by π/2 radians
// For example, to rotate a bivector representing the y-axis:
let y_axis = Rotor::new(0.0, 0.0, 1.0, 0.0);  // Pure y-axis bivector (e31)
let rotated = r * y_axis * r.reverse();
// rotated will be approximately equal to Rotor::new(0.0, 0.0, 0.0, 1.0) (z-axis)

License

This project is licensed under either of:

at your option.

Commit count: 14

cargo fmt