Linear Subspaces

We provide built-in data structures to work with (affine) linear subspaces $L$ where $L$ can be represented in either extrinsic coordinates $x$ with $L = \{ x | Ax = b \}$ or in intrinsic coordinates $u$ with $L = \{ Bu+p | u \}$.

Coordinates

To specify which coordinates are given / expected the following can be used:

Constructors

HomotopyContinuation.LinearSubspaceType
LinearSubspace(A, b)

An $m$-dimensional (affine) linear subspace $L$ in $n$-dimensional space given by the extrinsic description $L = \{ x | A x = b \}$.

julia> A = LinearSubspace([1 0 3; 2 1 3], [5, -2])
1-dim. (affine) linear subspace {x|Ax=b} with eltype Float64:
A:
2×3 Array{Float64,2}:
 1.0  0.0  3.0
 2.0  1.0  3.0
b:
2-element Array{Float64,1}:
  5.0
 -2.0

julia> dim(A)
1

julia> codim(A)
2

julia> ambient_dim(A)
3

A LinearSubspace holds always its extrinsic description, see also ExtrinsicDescription, as well as its intrinsic description, see IntrinsicDescription.

julia> intrinsic(A)
IntrinsicDescription{Float64}:
A:
3×1 Array{Float64,2}:
 -0.6882472016116853
  0.6882472016116853
  0.22941573387056186
b:
3-element Array{Float64,1}:
 -3.0526315789473677
 -3.947368421052632
  2.684210526315789

A LinearSubspace can be evaluated with either using Intrinsic or Extrinsic coordinates.

julia> u = [0.5]
1-element Array{Float64,1}:
 0.5

julia> x = A(u, Intrinsic)
3-element Array{Float64,1}:
 -3.3967551797532103
 -3.6032448202467893
  2.79891839325107

julia> A(x, Extrinsic)
  2-element Array{Float64,1}:
   0.0
   0.0

To change the used coordinates you can use coord_change.

julia> coord_change(A, Extrinsic, Intrinsic, x)
1-element Array{Float64,1}:
 0.49999999999999994
source
HomotopyContinuation.ExtrinsicDescriptionType
ExtrinsicDescription(A, b)

Extrinsic description of an $m$-dimensional (affine) linear subspace $L$ in $n$-dimensional space. That is $L = \{ x | A x = b \}$. Note that internally A and b will be stored such that the rows of A are orthonormal.

source
HomotopyContinuation.IntrinsicDescriptionType
IntrinsicDescription(A, b)

Intrinsic description of an $m$-dimensional (affine) linear subspace $L$ in $n$-dimensional space. That is $L = \{ u | A u + b \}$. Here, $A$ and $b$ are in orthogonal coordinates. That is, the columns of $A$ are orthonormal and $A' b = 0$.

source

Functions

HomotopyContinuation.codimFunction
codim(A::ExtrinsicDescription)

Codimension of the (affine) linear subspace A.

source
codim(A::IntrinsicDescription)

Codimension of the (affine) linear subspace A.

source
codim(A::LinearSubspace)

Codimension of the (affine) linear subspace A.

source
codim(W::WitnessSet)

The dimension of the algebraic set encoded by the witness set.

source
HomotopyContinuation.coord_changeFunction
coord_change(A::LinearSubspace, C₁::Coordinates, C₂::Coordinates, p)

Given an (affine) linear subspace A and a point p in coordinates C₁ compute the point x describing p in coordinates C₂.

Example

julia> A = LinearSubspace([1 0 3; 2 1 3], [5, -2]);

julia> u = [1.25];

julia> x = coord_change(A, Intrinsic, Extrinsic, u)
3-element Array{Float64,1}:
 -3.9129405809619744
 -3.087059419038025
  2.9709801936539915

julia> A(x, Extrinsic)
2-element Array{Float64,1}:
 0.0
 0.0

julia> x - A(u, Intrinsic)
3-element Array{Float64,1}:
 0.0
 0.0
 0.0
source
HomotopyContinuation.dimFunction
dim(A::ExtrinsicDescription)

Dimension of the (affine) linear subspace A.

source
dim(A::IntrinsicDescription)

Dimension of the (affine) linear subspace A.

source
dim(A::LinearSubspace)

Dimension of the (affine) linear subspace A.

source
dim(W::WitnessSet)

The dimension of the algebraic set encoded by the witness set.

source
HomotopyContinuation.geodesicFunction
geodesic(V::LinearSubspace, W::LinearSubspace)

Compute the geodesic distance between `V = {x | Ax = a}` and `W= {x | Bx = b}` as `sqrt(d^2 + ||a-b||^2)`, where `d` is the distance from the columnspan of `A` to the columnspan of `B` in the Grassmannian. This follows the derivation in [^LKK19].

Returns the geodesic $γ(t)$ by connecting V = {x | Ax = a} and W= {x | Bx = b}. A and B are interpolated in the Grassmannian using Stiefel coordinates. See also Corollary 4.3 in [LKK19]. a and b are interpolated linearly. Thus, $γ(t)$ is a geodesic in the Euclidean group.

source
HomotopyContinuation.geodesic_distanceFunction
geodesic_distance(V::LinearSubspace, W::LinearSubspace)

Compute the geodesic distance between V = {x | Ax = a} and W= {x | Bx = b} as sqrt(d^2 + ||a-b||^2), where d is the distance from the columnspan of A to the columnspan of B in the Grassmannian. This follows the derivation in [LKK19].

source
HomotopyContinuation.rand_subspaceFunction
rand_subspace(n::Integer; dim | codim, affine = true, real = false)

Generate a random LinearSubspace with given dimension dim or codimension codim (one of them has to be provided) in ambient space of dimension n. If real is true, then the extrinsic description is real. If affine then an affine linear subspace is generated. The subspace is generated by drawing the matrix A the extrinsic description independently from a normal distribuation using randn. The offset is drawn from the normal distribution scaled by sqrt(n), where n is the number of columns of A.

rand_subspace(x::AbstractVector; dim | codim, affine = true)

Generate a random LinearSubspace with given dimension dim or codimension codim (one of them has to be provided) in ambient space of dimension length(x) going through the given point x.

Example

Construction of a general random subspace:

julia> rand_subspace(3; dim = 1)
1-dim. affine linear subspace {x | Ax=b} with eltype ComplexF64:
A:
ComplexF64[-0.18709056988162928 - 0.021159068437462684im 0.3448082517062497 - 0.5619954950326371im 0.12814427601487394 + 0.716517124796854im; 0.6274330537397367 + 0.4327848781661207im 0.3433265716931795 - 0.4388117939096428im -0.09290449999579178 - 0.3161721696818136im]
b:
ComplexF64[0.1568834271069519 - 0.7893604951164849im, -1.068448434670914 + 3.422846499360692im]

julia> rand_subspace(4; codim = 1)
3-dim. affine linear subspace {x | Ax=b} with eltype ComplexF64:
A:
ComplexF64[-0.16031107752943963 - 0.6372670776364352im 0.4895718108240883 + 0.4093061519132399im -0.32944285959791164 + 0.12384710749057845im -0.17790282756300982 - 0.07388387107969129im]
b:
ComplexF64[-0.09372015908519082 + 0.3051873249600184im]
source
Base.intersectMethod
Base.intersect(L₁::LinearSubspace, L₂::LinearSubspace)

Intersect the two given linear subspaces. Throws an ErrorException if the intersection is the sum of the codimensions is larger than the ambient dimension.

source
  • LKK19Lim, Lek-Heng, Ken Sze-Wai Wong, and Ke Ye. "Numerical algorithms on the affine Grassmannian." SIAM Journal on Matrix Analysis and Applications 40.2 (2019): 371-393
  • LKK19Lim, Lek-Heng, Ken Sze-Wai Wong, and Ke Ye. "Numerical algorithms on the affine Grassmannian." SIAM Journal on Matrix Analysis and Applications 40.2 (2019): 371-393.