Skip to content

Commit

Permalink
Fix bug in map code that didn't handle substitutions efficiently (#1249)
Browse files Browse the repository at this point in the history
* bug fix: find_subst_for_map() now returns a matching variable if it finds one

add a print statement so that option(prot) will indicate when find_subst_for_map() finds a substitution map

* add a test to verify bug fix in github PR 1249

* add test for github PR 1249 to ok_s.lst
  • Loading branch information
BrentBaccala authored Nov 12, 2024
1 parent a102e74 commit 79e0737
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Tst/Short/bug_pr1249.res.gz.uu
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
begin 664 bug_pr1249.res.gz
M'XL("#R&,F<"`V)U9U]P<C$R-#DN<F5S`%5006K#,!"\^Q5#Z$$&(2(G31J,
M=0B]!$HOZ:T48Q,G+"BVD.36]NLKEV*UIUUF9G=VY_SV?'H%(!5>3D>LO/-"
M4[W*D_,ODRD$L*26/$OS9*Y0"G5_*XV5V?8@VN9+.%_Y962CL/1;@<YXZEIF
M;.?3N/=1P5AJO6X^&UW(761V?\;W`D%T@T6!-6<#'_F4\HN)ZB>%>V5P#0++
M!SZ,$Y\B>P@NG1YA`CTNL%PKT*6I-.@_'F*X,@I7SBO)H8+K:^?)]_,+2?DN
=/[email protected]>*K<B)^@YB1ZQV2:/R3?6ORBP%X!````
`
end
4 changes: 4 additions & 0 deletions Tst/Short/bug_pr1249.stat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1 >> tst_memory_0 :: 1731364412:44006, 64 bit:4.4.0:x86_64-Linux:edge:157192
1 >> tst_memory_1 :: 1731364412:44006, 64 bit:4.4.0:x86_64-Linux:edge:2097152
1 >> tst_memory_2 :: 1731364412:44006, 64 bit:4.4.0:x86_64-Linux:edge:2121864
1 >> tst_timer_1 :: 1731364412:44006, 64 bit:4.4.0:x86_64-Linux:edge:9
13 changes: 13 additions & 0 deletions Tst/Short/bug_pr1249.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
LIB "tst.lib";
tst_init();

option(prot);
printlevel=16;

ring r = 0,(x,y,z),dp;
map f = r,x,xyz,z;
poly p = y;
ideal i = y;
f(i);

tst_status(1);$
1 change: 1 addition & 0 deletions Tst/Short/ok_s.lst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ bug_ssi_algring
bug_ssi_attr
bug_subst
bug_zp
bug_pr1249
bug_tr237
; do not try bug_tr276 without 2.2 GB RAM free
bug_tr276
Expand Down
2 changes: 2 additions & 0 deletions kernel/maps/gen_maps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static void find_subst_for_map(const ring preimage_r, const ring image_r, const
}
}
}
return;
//Print("elms:%d, N:%d\n",IDELEMS(image),preimage_r->N);
//iiWriteMatrix((matrix)image,"_",1,image_r,0);
//PrintS("\npreimage:\n");rWrite(preimage_r);
Expand Down Expand Up @@ -107,6 +108,7 @@ ideal maMapIdeal(const ideal map_id, const ring preimage_r,const ideal image_id,
find_subst_for_map(preimage_r,image_r,image_id,var,p);
if (var!=0)
{
if (TEST_OPT_PROT) PrintS("map is a substitution\n");
return id_SubstPoly(map_id,var,p,preimage_r,image_r,nMap);
}
}
Expand Down

0 comments on commit 79e0737

Please sign in to comment.