Skip to main content

U1

Struct U1 

Source
pub struct U1 { /* private fields */ }
Expand description

An element of U(1), the circle group

Represented as a phase angle θ ∈ [0, 2π), corresponding to e^{iθ}.

§Representation

We use the angle representation rather than storing the complex number directly to avoid floating-point accumulation errors and to make the group structure (angle addition) explicit.

§Examples

use lie_groups::{LieGroup, U1};
use std::f64::consts::PI;

// Create elements
let g = U1::from_angle(0.5);
let h = U1::from_angle(0.3);

// Group multiplication (angle addition)
let product = g.compose(&h);
assert!((product.angle() - 0.8).abs() < 1e-10);

// Inverse (angle negation)
let g_inv = g.inverse();
assert!((g_inv.angle() - (2.0 * PI - 0.5)).abs() < 1e-10);

Implementations§

Source§

impl U1

Source

pub fn from_angle(theta: f64) -> Self

Create U(1) element from angle in radians

Automatically normalizes to [0, 2π)

§Arguments
  • theta - Phase angle in radians (any real number)
§Examples
use lie_groups::U1;

let g = U1::from_angle(0.5);
assert!((g.angle() - 0.5).abs() < 1e-10);

// Normalization
let h = U1::from_angle(2.0 * std::f64::consts::PI + 0.3);
assert!((h.angle() - 0.3).abs() < 1e-10);
Source

pub fn from_complex(z: Complex<f64>) -> Self

Create U(1) element from complex number

Extracts the phase angle from z = re^{iθ}, ignoring the magnitude.

§Arguments
  • z - Complex number (does not need to have unit modulus)
§Examples
use lie_groups::U1;
use num_complex::Complex;

let z = Complex::new(0.0, 1.0);  // i
let g = U1::from_complex(z);
assert!((g.angle() - std::f64::consts::PI / 2.0).abs() < 1e-10);
Source

pub fn angle(&self) -> f64

Get the phase angle θ ∈ [0, 2π)

§Examples
use lie_groups::U1;

let g = U1::from_angle(1.5);
assert!((g.angle() - 1.5).abs() < 1e-10);
Source

pub fn to_complex(&self) -> Complex<f64>

Convert to complex number e^{iθ}

Returns the complex number representation with unit modulus.

§Examples
use lie_groups::U1;

let g = U1::from_angle(std::f64::consts::PI / 2.0);  // π/2
let z = g.to_complex();

assert!(z.re.abs() < 1e-10);  // cos(π/2) ≈ 0
assert!((z.im - 1.0).abs() < 1e-10);  // sin(π/2) = 1
assert!((z.norm() - 1.0).abs() < 1e-10);  // |z| = 1
Source

pub fn trace_complex(&self) -> Complex<f64>

Trace of the 1×1 matrix representation

For U(1), the trace is just the complex number itself: Tr(e^{iθ}) = e^{iθ}

§Examples
use lie_groups::U1;

let g = U1::from_angle(0.0);  // Identity
let tr = g.trace_complex();

assert!((tr.re - 1.0).abs() < 1e-10);
assert!(tr.im.abs() < 1e-10);
Source

pub fn rotation(magnitude: f64) -> Self

Rotation generators for lattice updates

Returns a small U(1) element for MCMC proposals

§Arguments
  • magnitude - Step size in radians
§Examples
use lie_groups::U1;

let perturbation = U1::rotation(0.1);
assert!((perturbation.angle() - 0.1).abs() < 1e-10);
Source

pub fn random<R: Rng>(rng: &mut R) -> Self

Random U(1) element uniformly distributed on the circle

Requires the rand feature (enabled by default). Samples θ uniformly from [0, 2π).

§Examples
use lie_groups::U1;
use rand::SeedableRng;

let mut rng = rand::rngs::StdRng::seed_from_u64(42);
let g = U1::random(&mut rng);

assert!(g.angle() >= 0.0 && g.angle() < 2.0 * std::f64::consts::PI);
Source

pub fn random_small<R: Rng>(step_size: f64, rng: &mut R) -> Self

Random small perturbation for MCMC proposals

Samples θ uniformly from [-step_size, +step_size]

§Arguments
  • step_size - Maximum angle deviation
§Examples
use lie_groups::{U1, LieGroup};
use rand::SeedableRng;

let mut rng = rand::rngs::StdRng::seed_from_u64(42);
let delta = U1::random_small(0.1, &mut rng);

// Should be close to identity
assert!(delta.distance_to_identity() <= 0.1);

Trait Implementations§

Source§

impl Clone for U1

Source§

fn clone(&self) -> U1

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for U1

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for U1

Display implementation shows the phase angle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl LieGroup for U1

Source§

const DIM: usize = 1

Matrix dimension in the fundamental representation. Read more
Source§

type Algebra = U1Algebra

Associated Lie algebra type. Read more
Source§

fn identity() -> Self

The identity element e ∈ G. Read more
Source§

fn compose(&self, other: &Self) -> Self

Group composition (multiplication): g₁ · g₂ Read more
Source§

fn inverse(&self) -> Self

Group inverse: g⁻¹ Read more
Source§

fn adjoint(&self) -> Self

Adjoint representation element (for matrix groups: conjugate transpose). Read more
Source§

fn adjoint_action(&self, algebra_element: &U1Algebra) -> U1Algebra

Adjoint representation: Ad_g: 𝔤 → 𝔤 Read more
Source§

fn distance_to_identity(&self) -> f64

Geodesic distance from identity: d(g, e) Read more
Source§

fn exp(tangent: &U1Algebra) -> Self

Exponential map: 𝔤 → G Read more
Source§

fn log(&self) -> LogResult<U1Algebra>

Logarithm map: G → 𝔤 (inverse of exponential) Read more
Source§

fn dim() -> usize

Dimension of the fundamental representation. Read more
Source§

fn trace(&self) -> Complex<f64>

Trace in the fundamental representation. Read more
Source§

fn distance(&self, other: &Self) -> f64

Distance between two group elements: d(g, h) Read more
Source§

fn is_near_identity(&self, tolerance: f64) -> bool

Check if this element is approximately the identity. Read more
Source§

fn trace_identity() -> f64

Trace of the identity element Read more
Source§

fn reorthogonalize(&self) -> Self

Project element back onto the group manifold using Gram-Schmidt orthogonalization. Read more
Source§

impl Mul<&U1> for &U1

Group multiplication: g₁ · g₂ (phase addition)

Source§

type Output = U1

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &U1) -> U1

Performs the * operation. Read more
Source§

impl Mul<&U1> for U1

Source§

type Output = U1

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &U1) -> U1

Performs the * operation. Read more
Source§

impl MulAssign<&U1> for U1

Source§

fn mul_assign(&mut self, rhs: &U1)

Performs the *= operation. Read more
Source§

impl PartialEq for U1

Source§

fn eq(&self, other: &U1) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Abelian for U1

U(1) is abelian.

Complex multiplication commutes: e^{iα} · e^{iβ} = e^{iβ} · e^{iα}

§Mathematical Structure

For all g, h ∈ U(1):

g · h = e^{i(α+β)} = e^{i(β+α)} = h · g

This makes U(1) the structure group for Maxwell’s electromagnetism.

§Type Safety Example

// This function requires an abelian gauge group
fn compute_chern_number<G: Abelian>(conn: &NetworkConnection<G>) -> i32 {
    // Chern class computation requires commutativity
}

// ✅ Compiles: U(1) is abelian
let u1_conn = NetworkConnection::<U1>::new(graph);
compute_chern_number(&u1_conn);

// ❌ Won't compile: SU(2) is not abelian
let su2_conn = NetworkConnection::<SU2>::new(graph);
// compute_chern_number(&su2_conn);  // Compile error!

§Physical Significance

  • Gauge transformations commute (no self-interaction)
  • Field strength is linear: F = dA (no [A,A] term)
  • Maxwell’s equations are linear PDEs
  • Superposition principle holds
Source§

impl Compact for U1

U(1) is compact.

The circle group {e^{iθ} : θ ∈ ℝ} is diffeomorphic to S¹. All elements have unit modulus: |e^{iθ}| = 1.

§Topological Structure

U(1) ≅ SO(2) ≅ S¹ (the unit circle)

  • Closed and bounded in ℂ
  • Every sequence has a convergent subsequence (Bolzano-Weierstrass)
  • Admits a finite Haar measure

§Physical Significance

Compactness of U(1) ensures:

  • Well-defined Yang-Mills action
  • Completely reducible representations
  • Quantization of electric charge
Source§

impl Copy for U1

Source§

impl StructuralPartialEq for U1

Auto Trait Implementations§

§

impl Freeze for U1

§

impl RefUnwindSafe for U1

§

impl Send for U1

§

impl Sync for U1

§

impl Unpin for U1

§

impl UnsafeUnpin for U1

§

impl UnwindSafe for U1

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

Source§

impl<T, Right> ClosedMulAssign<Right> for T
where T: ClosedMul<Right> + MulAssign<Right>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,