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.37540713238778006, -0.2871526987733031, 0.19001436549134046, -0.24224204709951325, 0.3898920776956511, -0.2631121085865039, 0.20125710340128936, -0.13317562734665989, 0.16978051374587796, -0.2732641919485679, 0.047728823434156575, 0.4960668662631777, -0.37944654517737, 0.2510869472157733, -0.3201011457014722, 0.5152074227602418, -0.07110532713961237, -0.013233673223987219, -0.6094251952081852, 0.46615547336940744, -0.30846388305244943, 0.39324880670822526, -0.6329396408866192, 0.4761862057708209, -0.25626366907269016, 0.5138070226722267, -0.37394722289363685, 0.28603599928882195, -0.18927542434645603, 0.24129999929612747, -0.3883758381338222, 0.47682274296845795, -0.2866481935620006, 0.5592496948984659, -0.29972601551099626, 0.23673440510523713, -0.18108053218403386, 0.11982440900876669, -0.15275955612995917, 0.24586871453785242, -0.4635815941157215, 0.29481292857616714, -0.5677419871445221, 0.4522786881178251, 0.16109097587529592, -0.027601854962958937, 0.02111293702213354, -0.013970829280230723, 0.01781087590809098, -0.02866686232441008, 0.06316275555546191, -0.040759699047335715, 0.07823589045667215, -0.06752496119610615, -0.027858673779846976, 0.0057459894894116344), KVector{12, Float64, 12, 1}(3.725207779870274))

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.6802786028033538, 1.0726360358591152, 0.20379890365070694)

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.5027936495257943), Bivector{Float64, 3, 3}(-0.3169092643944742, -0.3937103207292622, 0.05619905408475569))

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


This page was generated using Literate.jl.