From 5450d623ec7e9b897f28e5fc0bde1a1a07e73f30 Mon Sep 17 00:00:00 2001 From: Ricardo Fabbri Date: Fri, 14 Jun 2024 04:23:50 -0700 Subject: [PATCH] merging chicago.m2 with eval_monodromy_demo.m2 --- tutorial/README.md | 14 ++++++++++++++ tutorial/ex-start.m2 | 23 ++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/tutorial/README.md b/tutorial/README.md index b8d331c..db560b8 100644 --- a/tutorial/README.md +++ b/tutorial/README.md @@ -10,4 +10,18 @@ C = { makeSLProgram(matrix{cameraParams},P3) } +## Evaluate to check equation +- How can we evaluate the the equations on the system? +evaluate(F,x0||p0) only for F gatematrix, but we ony have gateSystem in Ex, not +gatematrix. +Usually one creates gateSystem from Gatematrix: +GS = gateSystem(GS) + + +(p,x)=fabricateChicago CC +evaluate(F,x||p) + +(p0,x0) = fabricateChicago(CC) +evaluate(F,x0||p0) + diff --git a/tutorial/ex-start.m2 b/tutorial/ex-start.m2 index 7446bde..a49d368 100644 --- a/tutorial/ex-start.m2 +++ b/tutorial/ex-start.m2 @@ -1,10 +1,18 @@ +-- Ex and Pro marked bellow mean Example (simple) and Pro (fast) + + -- code for generating various evaluators restart needsPackage "SLPexpressions" needsPackage "MonodromySolver" -- "gateSystem" exists only in M2 v 1.14 + +-- Ex--------------------------------------------------------------------------- +-- Pro doesn't use declareVariable variables = declareVariable \ {x,y} params = declareVariable \ {a,b,c,d,e,f} + +-- Ex and Pro ------------------------------------------------------------------ GS = gateSystem( matrix{params}, matrix{variables}, @@ -13,10 +21,17 @@ GS = gateSystem( d*x+e*y+f} } ) +------------------------------------------------------------------------------- +-- Ex and Pro ------------------------------------------------------------------ cameraVars = flatten entries vars GS PH = parametricSegmentHomotopy GS +-- Pro only -------------------------------------------------------------------- +-- setDefault(CorrectorTolerance=>1e-8) + +------------------------------------------------------------------------------- + -- HxHt h=cCode( transpose(PH.GateHomotopy#"Hx"|PH.GateHomotopy#"Ht"), @@ -26,6 +41,9 @@ h=cCode( -- HxH h=cCode(transpose(PH.GateHomotopy#"Hx"|PH.GateHomotopy#"H"),gateMatrix{cameraVars|{PH.GateHomotopy#"T"}|flatten entries PH#Parameters}) +-- Maybe useful +-- cCode PH + -- Ex 1 -------------------------------------------------------------------------- -- monodromy needs an initial pair of parameter, solution -- the command below won't work for most use cases @@ -57,10 +75,9 @@ h=cCode(transpose(PH.GateHomotopy#"Hx"|PH.GateHomotopy#"H"),gateMatrix{cameraVar -- Ex 3 ------------------------------------------------------------------- -- parameter point --- V.BasePoint +V.BasePoint -- corresponding solutions --- points V.PartialSols -------------------------------------------------------------------------------- +points V.PartialSols -- Pro 3 -------------------------------------------------------------- -- quality check