Creating user-defined geometric spaces

Create a geometric space with default definitions

using SymbolicGA

@geometric_space weird_space (3, 4, 5)
@weird_space (macro with 2 methods)
x = rand(12); y = rand(12)
@weird_space x::1 ⟑ dual(y::1)
(KVector{10, Float64, 12, 66}(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6185577988379596, -0.30792524766295337, 0.44254273659334115, -0.4286893006401259, 0.40440831038799535, -0.26232312440714417, 0.13058749433365413, -0.187677196156837, 0.18180211607564045, -0.17150483223473803, 0.16306051639242342, 0.7742736677664961, -0.385442413552624, 0.5539485371444014, -0.5366076343430544, 0.5062141425548364, -0.49629274789313116, 0.0063625422883137085, -0.42800079640524497, 0.21306376135037833, -0.30621009719889564, 0.29662444225757234, -0.2798236142913853, -0.32679208547374083, 0.25141571582051214, -0.7524603179195422, -0.4745272109866371, 0.23622515024525426, -0.3394970865011184, 0.3288694097701629, -0.31024222471812285, 0.9430189521814976, -0.2748312706832398, 0.7996832799093774, -0.9032051661151835, 0.6643472637052009, -0.33071977444135237, 0.47530248051308766, -0.4604235277527737, 0.43434510878471644, -0.5203116470698315, 0.045526819149359896, -0.11826361002363121, 0.7110042552790121, -0.6136694525380196, -0.39946760506358997, 0.19885960770944236, -0.28579623029139056, 0.2768496146436224, -0.2611688342172618, 0.30918849591280156, -0.02581795645431923, 0.06651542576555916, -0.4249817474159991, 0.37181192793126927, -0.003943231040758378), KVector{12, Float64, 12, 1}(3.08788631505299))

Create a geometric space with extra definitions.

@geometric_space extra_space 3 quote
  >>(x, y) = versor_product(y, x)
  *(x, y) = geometric_product(y, x)
  I = 1.0::e123
end
@extra_space (macro with 2 methods)
x = rand(3); y = rand(3)
@extra_space begin
  yᵈ = y::1 * I
  yᵈ >> x::1
end
KVector{1, Float64, 3, 3}(0.6786395803490622, 0.34794789667059217, 0.5163487435258124)

Create a geometric space with non-default bindings.

bindings = Bindings(refs = Dict(:* => :geometric_product))
@geometric_space no_defaults 3 bindings
@no_defaults (macro with 2 methods)
x = rand(3); y = rand(3)
@no_defaults x::1 * y::1
(KVector{0, Float64, 3, 1}(0.5970065215276907), Bivector{Float64, 3, 3}(-0.1017322553685073, -0.04585451693798509, 0.15251371814634337))

Note that you will always have access to the built-in functions.


This page was generated using Literate.jl.