Changeset 3c3e3d in git
- Timestamp:
- Oct 29, 2013, 2:22:34 PM (9 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/oldpolymake.lib
r48935b4 r3c3e3d 132 132 points=intmatAddFirstColumn(points,"points"); 133 133 polytope polytop=polytopeViaPoints(points); 134 list graph=vertexAdjacencyGraph(polytop)[2]; 134 list graph=vertexAdjacencyGraph(polytop)[2]; 135 135 int i,j; 136 136 for (i=1;i<=size(graph);i++) … … 266 266 ///////////////////////////////////////////////////////////////////////////// 267 267 268 proc normalFan ( intmat vertices,intmataffinehull,list graph,int er,list #)268 proc normalFan (def vertices, def affinehull,list graph,int er,list #) 269 269 "USAGE: normalFan (vert,aff,graph,rays,[,#]); vert,aff intmat, graph list, rays int, # string 270 270 ASSUME: - vert is an integer matrix whose rows are the coordinate of … … 303 303 EXAMPLE: example normalFan; shows an example" 304 304 { 305 if (typeof(affinehull) != "intmat" && typeof (affinehull) != "bigintmat") 306 { 307 ERROR("normalFan: input affinehull has to be either intmat or bigintmat"); 308 list L; 309 return (L); 310 } 305 311 list ineq; // stores the inequalities of the cones 306 312 int i,j,k; … … 334 340 list pp; // contain strings representing the inequalities 335 341 // describing the normal cone 336 intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities 337 // as rows 342 if (typeof (vertices) == "intmat") 343 { 344 intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities 345 } // as rows 346 if (typeof (vertices) == "bigintmat") 347 { 348 bigintmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities 349 } // as rows 338 350 // consider all the vertices to which the ith vertex in the 339 351 // polytope is connected by an edge … … 2059 2071 } 2060 2072 2061 static proc intmatcoldelete ( intmatw,int i)2073 static proc intmatcoldelete (def w,int i) 2062 2074 "USAGE: intmatcoldelete(w,i); w intmat, i int 2063 2075 RETURN: intmat, the integer matrix w with the ith comlumn deleted 2064 2076 NOTE: the procedure is called by intmatsort and normalFan" 2065 2077 { 2066 if ((i<1) or (i>ncols(w)) or (ncols(w)==1)) 2067 { 2068 return(w); 2069 } 2070 if (i==1) 2071 { 2072 intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),2..ncols(w)]; 2073 return(M); 2074 } 2075 if (i==ncols(w)) 2076 { 2077 intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),1..ncols(w)-1]; 2078 return(M); 2079 } 2080 else 2081 { 2082 intmat M[nrows(w)][i-1]=w[1..nrows(w),1..i-1]; 2083 intmat N[nrows(w)][ncols(w)-i]=w[1..nrows(w),i+1..ncols(w)]; 2084 return(intmatconcat(M,N)); 2078 if (typeof(w)=="intmat") 2079 { 2080 if ((i<1) or (i>ncols(w)) or (ncols(w)==1)) 2081 { 2082 return(w); 2083 } 2084 if (i==1) 2085 { 2086 intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),2..ncols(w)]; 2087 return(M); 2088 } 2089 if (i==ncols(w)) 2090 { 2091 intmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),1..ncols(w)-1]; 2092 return(M); 2093 } 2094 else 2095 { 2096 intmat M[nrows(w)][i-1]=w[1..nrows(w),1..i-1]; 2097 intmat N[nrows(w)][ncols(w)-i]=w[1..nrows(w),i+1..ncols(w)]; 2098 return(intmatconcat(M,N)); 2099 } 2100 } 2101 if (typeof(w)=="bigintmat") 2102 { 2103 if ((i<1) or (i>ncols(w)) or (ncols(w)==1)) 2104 { 2105 return(w); 2106 } 2107 if (i==1) 2108 { 2109 bigintmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),2..ncols(w)]; 2110 return(M); 2111 } 2112 if (i==ncols(w)) 2113 { 2114 bigintmat M[nrows(w)][ncols(w)-1]=w[1..nrows(w),1..ncols(w)-1]; 2115 return(M); 2116 } 2117 else 2118 { 2119 bigintmat MN[nrows(w)][ncols(w)-1]; 2120 MN[1..nrows(w),1..i-1]=w[1..nrows(w),1..i-1]; 2121 MN[1..nrows(w),i..ncols(w)-1]=w[1..nrows(w),i+1..ncols(w)]; 2122 return(MN); 2123 } 2124 } else 2125 { 2126 ERROR("intmatcoldelete: input matrix has to be of type intmat or bigintmat"); 2127 intmat M; return(M); 2085 2128 } 2086 2129 } … … 2379 2422 } 2380 2423 2381 static proc intmatAddFirstColumn ( intmatM,string art)2424 static proc intmatAddFirstColumn (def M,string art) 2382 2425 "USAGE: intmatAddFirstColumn(M,art); M intmat, art string 2383 2426 ASSUME: - M is an integer matrix where a first column of 0's or 1's should be added … … 2387 2430 RETURN: intmat, a first column has been added to the matrix" 2388 2431 { 2389 intmat N[nrows(M)][ncols(M)+1]; 2390 int i,j; 2391 for (i=1;i<=nrows(M);i++) 2392 { 2393 if (art=="rays") 2394 { 2395 N[i,1]=0; 2396 } 2397 else 2398 { 2399 N[i,1]=1; 2400 } 2401 for (j=1;j<=ncols(M);j++) 2402 { 2403 N[i,j+1]=M[i,j]; 2404 } 2405 } 2406 return(N); 2407 } 2408 2409 2410 2432 if (typeof (M) == "intmat") 2433 { 2434 intmat N[nrows(M)][ncols(M)+1]; 2435 int i,j; 2436 for (i=1;i<=nrows(M);i++) 2437 { 2438 if (art=="rays") 2439 { 2440 N[i,1]=0; 2441 } 2442 else 2443 { 2444 N[i,1]=1; 2445 } 2446 for (j=1;j<=ncols(M);j++) 2447 { 2448 N[i,j+1]=M[i,j]; 2449 } 2450 } 2451 return(N); 2452 } 2453 if (typeof (M) == "bigintmat") 2454 { 2455 bigintmat N[nrows(M)][ncols(M)+1]; 2456 int i,j; 2457 for (i=1;i<=nrows(M);i++) 2458 { 2459 if (art=="rays") 2460 { 2461 N[i,1]=0; 2462 } 2463 else 2464 { 2465 N[i,1]=1; 2466 } 2467 for (j=1;j<=ncols(M);j++) 2468 { 2469 N[i,j+1]=M[i,j]; 2470 } 2471 } 2472 return(N); 2473 } 2474 else 2475 { 2476 ERROR ("intmatAddFirstColumn: input matrix has to be either intmat or bigintmat"); 2477 intmat N; 2478 return (N); 2479 } 2480 } 2481 2482 2483
Note: See TracChangeset
for help on using the changeset viewer.