Skip to content

Commit

Permalink
more on run from chicago script t
Browse files Browse the repository at this point in the history
  • Loading branch information
rfabbri committed Jun 15, 2024
1 parent 485ec6d commit a7dbec0
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 3 deletions.
2 changes: 2 additions & 0 deletions scripts/eval_monodromy_demo.m2
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Integrated into ~/tutorial/
--
-- code for generating various evaluators
restart
needsPackage "SLPexpressions"
Expand Down
22 changes: 22 additions & 0 deletions tutorial/MinusUtility.m2
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,25 @@ cCode (String, List,List) := (outfile, outputs,inputs) -> (

cCode (String, GateMatrix,GateMatrix) := (outfile, M,I) -> cCode(outfile,
flatten entries M, flatten entries I)

-- from original Chicago parser.m2
readStartSys = filename -> (
l := separate("\n", get filename);
p0 := value(l#1);
sols := for i from 3 to #l-2 list value(l#i);
(transpose matrix p0, sols/(x->transpose matrix x))
)

-- from original common.m2
-- write starting parameters and solutions to file
writeStartSys = method(Options=>{Filename=>"startSys"})
writeStartSys (Matrix, List) := o -> (M, sols) -> writeStartSys(point M, sols, o)
writeStartSys (Point, List) := o -> (p, sols) -> (
assert(instance(o.Filename,String));
f := openOut o.Filename;
f << "Parameter values: " << endl;
f << toExternalString p << endl;
f << "Solutions : " << endl;
for s in sols do f << toExternalString s << endl;
close f;
)
26 changes: 23 additions & 3 deletions tutorial/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# TODO
## 4Tim
# CVPR 204 fast Homotopy Continuation tutorial




# Developer Internal Notes

## Starting files
The tutorial started from Chicago trifocal problem code

mostly

minus/m2/chicago/formulation-minors-original-in-minus/t
minus/scripts/eval_monodromy_demo.m2

and the code after "end" in
/Users/rfabbri/cprg/vxlprg/lemsvpe/minus/M2/chicago/formulation-minors-original-in-minus/chicago.m2



## TODO
### 4Tim

- createSeedPair vs fabricateChicago exactly?

Expand All @@ -10,7 +30,7 @@ C = {
makeSLProgram(matrix{cameraParams},P3)
}

## Evaluate to check equation
### Evaluate to check equation
- How can we evaluate the the equations on the system?

- evaluate(F,x0||p0) only for F gatematrix,
Expand Down
53 changes: 53 additions & 0 deletions tutorial/ex-run.m2
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
-- EX-RUN Homotopy Continuation Tutorial EX-RUN
--
-- NAME
-- Fast HC Code Inteligencer - exactly how to craft your fast HC
-- Module: Final, fast solver.
--
-- DESCRIPTION
--
-- This script shows how to craft a fast solver for your problem
--
-- It is broken down into Generic and Pro blocks, the pro blocks you can
-- and adapt if needed
--
-- The design-goal of the file is to closely match what will be in the fast C++
-- solver, so you can start with a generic and incrementally craft and test out the pro features
--
-- The file is not based on generic tutorial scripts. Rather, it is rather technical
-- based on techniques that originally solved a very hard problem and for the
-- first time ever before, trifical pose from points and tangents Fabbri, etal, CVPR'10.
-- It is important to keep in mind that, while there are novelties in the -- associated m2
-- scripts of PLMP, this version of them is the definitive account
-- of what matterscarefully for writing a fast C++ solver
--
-- Run ex-start first once
--
-- LEGEND
-- - Ex and Pro marked bellow mean Example (simple) and Pro (fast)
-- - YOU shows where can you make it faster for your problem

-- OTHERS
-- - Think of this as a prompt precise enough for LLM to help generate a fast solver
--
-- TODO
-- - update with PLMP versions of common, etc, making _sure_ it
-- doesn't impact performance
--
-- AUTHORS
-- Ricardo Fabbri (C++ and M2) and Timothy Duff (M2)
--

restart
needs "parser.m2"
elapsedTime needs "chicago.m2"

(p0,sols) = readStartSys "startSys";
-- verify options are set as desired
netList((keys options trackHomotopy)/(opt ->(opt, getDefault opt)))
NAGtrace 3
setRandomSeed 0


-- (pLines, x) = parseFile(1,Tests=>true);
-- elapsedTime K = solveChicago(p0, pLines, sols);

0 comments on commit a7dbec0

Please sign in to comment.