# Changeset 3c3e3d in git

Ignore:
Timestamp:
Oct 29, 2013, 2:22:34 PM (9 years ago)
Branches:
Children:
8275a9c69d35539035837ac649f76ebc01f927c0
Parents:
48935b4077cd8f5a0f1e6050b74b4fbd0f364df1
git-author:
Martin Lee <martinlee84@web.de>2013-10-29 14:22:34+01:00
git-committer:
Yue Ren <ren@mathematik.uni-kl.de>2013-12-11 17:46:45+01:00
Message:
`fix: oldpolymake.lib bigintmat <-> intmat issues`
File:
1 edited

Unmodified
Removed
• ## Singular/LIB/oldpolymake.lib

 r48935b4 points=intmatAddFirstColumn(points,"points"); polytope polytop=polytopeViaPoints(points); list graph=vertexAdjacencyGraph(polytop)[2]; list graph=vertexAdjacencyGraph(polytop)[2]; int i,j; for (i=1;i<=size(graph);i++) ///////////////////////////////////////////////////////////////////////////// proc normalFan (intmat vertices,intmat affinehull,list graph,int er,list #) proc normalFan (def vertices, def affinehull,list graph,int er,list #) "USAGE:  normalFan (vert,aff,graph,rays,[,#]);   vert,aff intmat,  graph list, rays int, # string ASSUME:  - vert is an integer matrix whose rows are the coordinate of EXAMPLE: example normalFan;   shows an example" { if (typeof(affinehull) != "intmat" && typeof (affinehull) != "bigintmat") { ERROR("normalFan: input affinehull has to be either intmat or bigintmat"); list L; return (L); } list ineq; // stores the inequalities of the cones int i,j,k; list pp;  // contain strings representing the inequalities // describing the normal cone intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities // as rows if (typeof (vertices) == "intmat") { intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities }                                             // as rows if (typeof (vertices) == "bigintmat") { bigintmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities }                                                // as rows // consider all the vertices to which the ith vertex in the // polytope is connected by an edge } static proc intmatcoldelete (intmat w,int i) static proc intmatcoldelete (def w,int i) "USAGE:      intmatcoldelete(w,i); w intmat, i int RETURN:      intmat, the integer matrix w with the ith comlumn deleted NOTE:        the procedure is called by intmatsort and normalFan" { if ((i<1) or (i>ncols(w)) or (ncols(w)==1)) { return(w); } if (i==1) { intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),2..ncols(w)]; return(M); } if (i==ncols(w)) { intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),1..ncols(w)-1]; return(M); } else { intmat M[nrows(w)][i-1]=w[1..nrows(w),1..i-1]; intmat N[nrows(w)][ncols(w)-i]=w[1..nrows(w),i+1..ncols(w)]; return(intmatconcat(M,N)); if (typeof(w)=="intmat") { if ((i<1) or (i>ncols(w)) or (ncols(w)==1)) { return(w); } if (i==1) { intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),2..ncols(w)]; return(M); } if (i==ncols(w)) { intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),1..ncols(w)-1]; return(M); } else { intmat M[nrows(w)][i-1]=w[1..nrows(w),1..i-1]; intmat N[nrows(w)][ncols(w)-i]=w[1..nrows(w),i+1..ncols(w)]; return(intmatconcat(M,N)); } } if (typeof(w)=="bigintmat") { if ((i<1) or (i>ncols(w)) or (ncols(w)==1)) { return(w); } if (i==1) { bigintmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),2..ncols(w)]; return(M); } if (i==ncols(w)) { bigintmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),1..ncols(w)-1]; return(M); } else { bigintmat MN[nrows(w)][ncols(w)-1]; MN[1..nrows(w),1..i-1]=w[1..nrows(w),1..i-1]; MN[1..nrows(w),i..ncols(w)-1]=w[1..nrows(w),i+1..ncols(w)]; return(MN); } } else { ERROR("intmatcoldelete: input matrix has to be of type intmat or bigintmat"); intmat M; return(M); } } } static proc intmatAddFirstColumn (intmat M,string art) static proc intmatAddFirstColumn (def M,string art) "USAGE:  intmatAddFirstColumn(M,art);  M intmat, art string ASSUME:  - M is an integer matrix where a first column of 0's or 1's should be added RETURN:  intmat, a first column has been added to the matrix" { intmat N[nrows(M)][ncols(M)+1]; int i,j; for (i=1;i<=nrows(M);i++) { if (art=="rays") { N[i,1]=0; } else { N[i,1]=1; } for (j=1;j<=ncols(M);j++) { N[i,j+1]=M[i,j]; } } return(N); } if (typeof (M) == "intmat") { intmat N[nrows(M)][ncols(M)+1]; int i,j; for (i=1;i<=nrows(M);i++) { if (art=="rays") { N[i,1]=0; } else { N[i,1]=1; } for (j=1;j<=ncols(M);j++) { N[i,j+1]=M[i,j]; } } return(N); } if (typeof (M) == "bigintmat") { bigintmat N[nrows(M)][ncols(M)+1]; int i,j; for (i=1;i<=nrows(M);i++) { if (art=="rays") { N[i,1]=0; } else { N[i,1]=1; } for (j=1;j<=ncols(M);j++) { N[i,j+1]=M[i,j]; } } return(N); } else { ERROR ("intmatAddFirstColumn: input matrix has to be either intmat or bigintmat"); intmat N; return (N); } }
Note: See TracChangeset for help on using the changeset viewer.