KlausC / VectorSpaces.jl

Finite Dimensional Vector Spaces over Real or Complex

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VectorSpaces

Build Status Coverage Status

This package supports Standard vector spaces over Number.

Basic Operations

A vector space is generated by one of the constructors:

  • VectorSpace([T,] n) for the full space of dimension n (T^n)
  • ZeroSpace([T,] n) for the zero subspace in the space of dimension n
  • VectorSpace(M::Matrix) for a subspace of the space of dimension size(M, 1)
  • V' for the orthogonal complement of VectorSpace V.

or derived from a (n, m) abstract matrix M:

  • image(M) = VectorSpace(M)
  • kernel(M) subspace of VectorSpace(n)
  • M * V = M(V) the image of V under the mapping matrix M
  • M \ V inverse image of V under the mapping M

An orthogonal basis is given by span(V::VectorSpace), which is a orthogonal or unitary matrix of order dim(V), rank(V).

The following invariants are maintained:

  • image(span(V)) == V
  • rank(image(M)) == rank(M)
  • kernel(M') == image(M)'
  • kernel(M)' == image(M')

Binary operators with vector spaces are

  • V ∩ W the vector space intersection
  • V ∪ W the vector space sum
  • V ⊆ W subset relation
  • v ∈ W element relation for a vector v

Usage

(...) pkg> add VectorSpaces
julia> using VectorSpaces

julia> F = rand(26, 5);

julia> VF = image(F)
VectorSpace{Float64, Matrix{Float64}} rank 5 dim 26

julia> G = F[:,3:4];

julia> G = [G ones(26)];

julia> VG = image(G)
VectorSpace{Float64, Matrix{Float64}} rank 3 dim 26

julia> VF ∩ VG
VectorSpace{Float64, Matrix{Float64}} rank 2 dim 26

julia> VF ∪ VG
VectorSpace{Float64, Matrix{Float64}} rank 6 dim 26

span(VF ∩ VG)
26×2 Matrix{Float64}:
    ...

julia> kernel(F')
VectorSpace{Float64, Matrix{Float64}} rank 21 dim 26

julia> kernel(F') == image(F)'
true
 
julia> H = [G G[:,1]+G[:,2]];

julia> rank(H) == rank(image(H))
true

julia> kernel(H)' == image(H')
true

Implementation

Each space is represented by a dimension dim and a rank rank. If the rank is not 0 and less than dim, a qr-factorization is used to define an orthonormal (or unitary) basis. The orthogonal complement V' of a vector space V is represented by the same qr-factors and an additional indicator.

About

Finite Dimensional Vector Spaces over Real or Complex

License:MIT License


Languages

Language:Julia 100.0%