Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions CODE/common.m2
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ leverageScores = M -> (


-- indexes subsystem giving Jacobian rank
rowSelector = method(Options=>{Threshold=>1e-4})
rowSelector Matrix := o -> J0 -> (
rowSelectorPLMP = method(Options=>{Threshold=>1e-4})
rowSelectorPLMP Matrix := o -> J0 -> (
(m , n) := size J0;
J0' := J0^{0}; -- should technically check this is not identically zero
i := 1;
Expand All @@ -405,7 +405,7 @@ rowSelector Matrix := o -> J0 -> (

leverageScoreRowSelector = J0 -> (
sortedRows := (leverageScores J0)/last;
r := rowSelector J0^(sortedRows);
r := rowSelectorPLMP J0^(sortedRows);
sort(r/(i->sortedRows#i))
)

Expand Down Expand Up @@ -493,24 +493,24 @@ cpMatrix = t -> matrix{{0,-t_(2,0),t_(1,0)},{t_(2,0),0,-t_(0,0)},{-t_(1,0),t_(0,

essential = (R,t) -> R * cpMatrix t

pCompose = method()
pCompose (MutableHashTable, MutableHashTable) := (H1, H2) -> (
pCompose2 = method()
pCompose2 (MutableHashTable, MutableHashTable) := (H1, H2) -> (
new MutableHashTable from apply(keys H1,k-> if H2#?(H1#k) then k=> H2#(H1#k))
)

writePermutations = method(Options=>{})
writePermutations (HomotopyNode, String) := o -> (V, filename) -> (
writePermutationsPLMP = method(Options=>{})
writePermutationsPLMP (HomotopyNode, String) := o -> (V, filename) -> (
-- assume for now that G has 2 nodes
G := V.Graph;
V1 := first G.Vertices;
V2 := last G.Vertices;
E1 := toList V1.Edges;
-- "petal loops" based at V1
e1 := first E1;
perms := apply(drop(E1,1),e->values pCompose(e1.Correspondence12,e.Correspondence21));
perms := apply(drop(E1,1),e->values pCompose2(e1.Correspondence12,e.Correspondence21));
writePermutations(perms,filename);
)
writePermutations (List, String) := o -> (L, filename) -> (
writePermutationsPLMP (List, String) := o -> (L, filename) -> (
perms := L/(P->P/(i->i+1)); -- increment letters by 1 for GAP
file := openOut (currentFileDirectory | filename);
for i from 0 to #perms-1 do file << "p" << i << ":= PermList(" << toString(new Array from perms#i) << ");" << endl;
Expand Down
2 changes: 1 addition & 1 deletion CODE/monodromy_example.m2
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ concatenate ts
-- post-process the output of monodromySolver


writePermutations(V, "example" | ".txt")
writePermutationsPLMP(V, "example" | ".txt")
2 changes: 1 addition & 1 deletion CODE/numerical-problem-builder.m2
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ if (instance(Jpivots, Symbol) and JACOBIAN) then (
(M,N) = size J;
elapsedTime JGS = gateSystem(paramMatrix, varMatrix, transpose matrix{flatten entries J});
elapsedTime J0 = matrix(transpose evaluate(JGS,y,c),M,N);
elapsedTime Jpivots = rowSelector(J0,Threshold=>1e-6);
elapsedTime Jpivots = rowSelectorPLMP(J0,Threshold=>1e-6);
elapsedTime S = first SVD J0^Jpivots;
<< "pivot indices are " << toString Jpivots << endl;
)
Expand Down