TorchLean API

NN.Proofs.Tensor.Euclidean

Real tensors as Euclidean space #

A real tensor of shape s is a finite family of reals indexed by s.Coord. This file transports the Euclidean inner-product structure of EuclideanSpace ℝ s.Coord along the coordinate view, so that Tensor ℝ s is a NormedAddCommGroup and an InnerProductSpace with

All Mathlib facts about inner product spaces (Cauchy-Schwarz, the triangle inequality, norm_smul, LipschitzWith, finite dimensionality) then apply to real tensors directly. The metric topology this induces is the one every analytic statement about real tensors should use; continuous_vectorEquiv shows the rank-one coordinate view is a homeomorphism for it.

The instances are stated on the native representation Internal.Rep ℝ s (with s : List Nat) rather than on Tensor ℝ shape: the public type is a reducible abbreviation whose shape argument unfolds to a dimension list, so only representation-level instances are found for literal shapes such as Tensor ℝ [n].

The coordinate view of a real tensor as a point of Euclidean space.

Instances For
    @[simp]

    Coordinates of the Euclidean view are the tensor's coordinates.

    @[simp]

    Coordinates of a tensor rebuilt from Euclidean space are the point's coordinates.

    @[instance_reducible]

    The Euclidean norm on real tensors.

    @[instance_reducible]

    The Euclidean inner product on real tensors.

    Real tensors of a fixed shape form a finite-dimensional real vector space.

    The tensor norm is the norm of its Euclidean view.

    The tensor inner product is the inner product of the Euclidean views.

    The inner product of two real tensors is the sum of coordinatewise products.

    The norm of a real tensor is the square root of its sum of squares.

    The squared norm of a real tensor is its sum of squares.

    Every coordinate of a real tensor is bounded by the Euclidean norm.

    theorem TorchLean.Tensor.dist_eq_sqrt_sum {s : Internal.Shape} (x y : Internal.Rep s) :
    dist x y = (∑ i : Internal.Coord s, (x.get i - y.get i) ^ 2)

    The distance between real tensors is the square root of the summed squared differences.

    The rank-one coordinate view as a real linear equivalence.

    Instances For

      The rank-one coordinate view is continuous for the Euclidean topology.

      Rebuilding a rank-one tensor from its coordinates is continuous.