chakravala / Grassmann.jl

⟨Grassmann-Clifford-Hodge⟩ multilinear differential geometric algebra

Home Page:https://grassmann.crucialflow.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `rand` method for chains and other types

eschnett opened this issue · comments

For property testing I like to use random vectors (simplices, chains, multivectors). It would be convenient to have a method for rand() that does that, called e.g. as rand(Chain{V,1,Float64}).

This is not urgent.

This issue has been pretty much solved for now

julia> rand(SubManifold,(5,5))
5×5 Array{SubManifold,2}:
    v  v₂₃    v₁    v₁    v₁
  v₁₂    v   v₃₄     v    v₂
   v₁  v₂₃   v₁₂    v₃  v₁₄₅
  v₂₃    v  v₁₂₅  v₂₃₅    v₃
 v₁₂₃  v₁₂   v₁₂   v₁₄    v₂

julia> rand(Chain{V,1,Chain{V,1}})
(0.04970301106098196v₁ - 0.6971344804252184v₂ - 0.9913497819176342v₃)v₁ + (-0.4983210314971731v₁ - 0.8117592185717495v₂ + 0.19573575048348868v₃)v₂ + (0.43948082455712756v₁ - 0.7349964706953829v₂ - 0.8622002476878037v₃)v₃

There is a similar type stability issue for rand in Grassmann as in StaticArrays, see JuliaArrays/StaticArrays.jl#800