1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818
|
newPackage(
"ConvexInterface",
Version =>"0.33",
Date =>"December 1, 2010",
Authors =>{{Name =>"Janko Boehm",
Email =>"boehm@mathematik.uni-kl.de",
HomePage =>"http://www.math.uni-sb.de/ag/schreyer/jb/"}
},
Headline =>"interface to Convex",
Keywords => {"Interfaces"},
DebuggingMode => false,
Configuration =>{"ConvexPath"=>""},
CacheExampleOutput => true,
PackageImports => { "MapleInterface" },
AuxiliaryFiles => true
)
-- For information see documentation key "ConvexInterface" below.
export({"mConvexHullFaces","mConvexHullFacesAndDuals","mHomology","FinitelyGeneratedAbelianGroup","toFile","readConvexHullFaces","mLatticePoints","mPosHullFaces","mPosHullFacesAndDuals","readPosHullFaces","callConvex","mIsSubcone"})
-- if you want to put the library convex.m in a non standard directory
-- on a Windows system, then write the path to this directory as follows:
-- "ConvexPath"=>///C:\\Programme\\Maple 9.5\\convex///
pathconvex:=((options ConvexInterface).Configuration)#"ConvexPath"
pathconvex="\""|pathconvex|"\""
callConvex=method(Options=>{toFile=>null})
callConvex(String):=opts->(convexprogram)->(
mapleprogram:=
///
libname0:=libname:
libname:=libname0,placeholder2;
with(convex):
///|convexprogram;
callMaple("",pathconvex,mapleprogram,store=>opts.toFile))
mIsSubcone=method(Options=>{toFile=>null})
mIsSubcone(List,List):=opts->(L,Lb)->(
L1:=toString {apply(L,entries),apply(Lb,entries)};
---------------------------------------
mapleprogram:=
///
libname0:=libname:
libname:=libname0,placeholder2;
with(convex):
L:=placeholder1;
P1:=poshull(op(L[1]));
P2:=poshull(op(L[2]));
returnvalue:=(P1&<=P2);
///;
---------------------------------------
Lfc:=callMaple(L1,pathconvex,mapleprogram,store=>opts.toFile);
Lfc
)
mPosHullFaces=method(Options=>{toFile=>null})
mPosHullFaces(List):=opts->(L)->(
L1:=toString apply(L,entries);
---------------------------------------
mapleprogram:=
///
libname0:=libname:
libname:=libname0,placeholder2;
with(convex):
P:=poshull(op(placeholder1));
LP:=convert(P,list):
fc:=convert(faces(P),list):
fcvert:=[]:
for j from 1 to nops(fc) do
fcvert1:=[]:
for jj from 1 to nops(fc[j]) do
f:=convert(fc[j][jj],list);
fcvert1:=[op(fcvert1),f[2]]:
od:
fcvert:=[op(fcvert),fcvert1]:
od:
returnvalue:=[LP[4],fcvert];
///;
---------------------------------------
Lfc:=callMaple(L1,pathconvex,mapleprogram,store=>opts.toFile);
{matrix Lfc#0,Lfc#1}
)
-*
L= {{0,1,1,0,0},{0,1,0,1,0},{0,1,0,0,0},{1,0,0,0,1},{1,0,-1,-1,-1},{1,0,0,0,0}};
L=apply(L,vector)
C=hull L
*-
mPosHullFacesAndDuals=method(Options=>{toFile=>null})
mPosHullFacesAndDuals(List):=opts->(L)->(
L1:=toString apply(L,entries);
---------------------------------------
mapleprogram:=
///
libname0:=libname:
libname:=libname0,placeholder2;
with(convex):
P:=poshull(op(placeholder1));
LP:=convert(P,list):
fc:=convert(faces(P),list):
fcvert:=[]:
for j from 1 to nops(fc) do
fcvert1:=[]:
for jj from 1 to nops(fc[j]) do
f:=convert(fc[j][jj],list);
fcvert1:=[op(fcvert1),[f[2],f[3]]]:
od:
fcvert:=[op(fcvert),fcvert1]:
od:
returnvalue:=[LP[4],LP[7],fcvert];
///;
---------------------------------------
Lfc:=callMaple(L1,pathconvex,mapleprogram,store=>opts.toFile);
{matrix Lfc#0,matrix Lfc#1,Lfc#2}
)
mConvexHullFaces=method(Options=>{toFile=>null})
mConvexHullFaces(List):=opts->(L)->(
L1:=toString apply(L,entries);
---------------------------------------
mapleprogram:=
///
libname0:=libname:
libname:=libname0,placeholder2;
with(convex):
P:=convhull(op(placeholder1));
LP:=convert(P,list):
fc:=convert(faces(P),list):
fcvert:=[]:
for j from 1 to nops(fc) do
fcvert1:=[]:
for jj from 1 to nops(fc[j]) do
f:=convert(fc[j][jj],list);
fcvert1:=[op(fcvert1),f[2]]:
od:
fcvert:=[op(fcvert),fcvert1]:
od:
returnvalue:=[LP[4],fcvert];
///;
---------------------------------------
Lfc:=callMaple(L1,pathconvex,mapleprogram,store=>opts.toFile);
{matrix cutCone Lfc#0, Lfc#1}
)
cutCone=method()
cutCone(List):=(L)->(
L1:={};
a:=0;
rat:=false;
for j from 0 to #L-1 do (
a=L#j#(#(L#j)-1);
if a==0 then error("0 not in interior");
if a!=1 then rat=true;
L1=append(L1,apply(toList(0..#(L#j)-2),jj->L#j#jj/a));
);
if rat==true then return(apply(L1,j->apply(j,jj->sub(jj,QQ))));
apply(L1,j->apply(j,jj->sub(jj,ZZ))))
-*
L={vector {1,0,0},vector {-1,0,0},vector {0,1,0},vector {0,-1,0},vector {0,0,1},vector {0,0,-1}};
P=mConvexHullFaces(L)
*-
mConvexHullFacesAndDuals=method(Options=>{toFile=>null})
mConvexHullFacesAndDuals(List):=opts->(L)->(
L1:=toString apply(L,entries);
---------------------------------------
mapleprogram:=
///
libname0:=libname:
libname:=libname0,placeholder2;
with(convex):
P:=convhull(op(placeholder1));
LP:=convert(P,list):
fc:=convert(faces(P),list):
fcvert:=[]:
for j from 1 to nops(fc) do
fcvert1:=[]:
for jj from 1 to nops(fc[j]) do
f:=convert(fc[j][jj],list);
fcvert1:=[op(fcvert1),[f[2],f[3]]]:
od:
fcvert:=[op(fcvert),fcvert1]:
od:
returnvalue:=[LP[4],LP[7],fcvert];
///;
---------------------------------------
Lfc:=callMaple(L1,pathconvex,mapleprogram,store=>opts.toFile);
{matrix cutCone Lfc#0,matrix cutCone Lfc#1,Lfc#2}
)
-*
L={vector {1,0,0},vector {-1,0,0},vector {0,1,0},vector {0,-1,0},vector {0,0,1},vector {0,0,-1}};
P=mConvexHullFacesAndDuals(L)
*-
readConvexHullFaces=method()
readConvexHullFaces(String):=(fn)->(
Lfc:=readMaple(fn);
if #Lfc==3 then (
return({matrix cutCone Lfc#0,matrix cutCone Lfc#1,Lfc#2})
) else (
return({matrix cutCone Lfc#0,Lfc#1})
)
)
readPosHullFaces=method()
readPosHullFaces(String):=(fn)->(
Lfc:=readMaple(fn);
if #Lfc==3 then (
return({matrix Lfc#0,matrix Lfc#1,Lfc#2})
) else (
return({matrix Lfc#0,Lfc#1})
)
)
mHomology=method()
mHomology(List):=(L1)->(
---------------------------------------
mapleprogram:=
///
libname0:=libname:
libname:=libname0,placeholder2;
with(convex):
topcomplex:=proc(B)
local j,jj,L;
L:=[]:
for j from 2 to nops(B) do
for jj from 1 to nops(B[j]) do
L:=[op(L),convhull(op(B[j][jj]))]:
od:
od:
return(pcomplex(op(L)));
end proc:
h:=convert(homology(simplicialsubdiv(topcomplex(placeholder1)),integer),list);
returnvalue:=[];
for j from 1 to nops(h) do
returnvalue:=[op(returnvalue),[rank(h[j]),torsion(h[j])]];
od:
///;
---------------------------------------
h:=callMaple(toString L1,pathconvex,mapleprogram);
apply(h,finitelyGeneratedAbelianGroup))
-- a type to accept the result of homology:
FinitelyGeneratedAbelianGroup=new Type of HashTable
FinitelyGeneratedAbelianGroup.synonym="finitely generated abelian group"
FinitelyGeneratedAbelianGroup#{Standard,AfterPrint} = m -> (
<< endl;
<< concatenate(interpreterDepth:"o") << lineNumber << " : "
<< "finitely generated abelian group"
<< endl;)
protect torsion
net FinitelyGeneratedAbelianGroup := (G) -> (
NG:="";
if G.rank>1 then NG=NG|net(G.rank)|" "|net(ZZ);
if G.rank==1 then NG=NG|net(ZZ);
T:=G.torsion;
if #T>0 then (
for j from 0 to #T-1 do (
if NG=="" then (
NG="ZZ/"|T#j;
) else (
NG=NG|" + ZZ/"|T#j;
);
);
);
if NG=="" then NG=net(0);
NG)
finitelyGeneratedAbelianGroup=method()
finitelyGeneratedAbelianGroup(List):=(L)->(
new FinitelyGeneratedAbelianGroup from {
symbol rank => L#0,
symbol torsion => L#1}
)
--finitelyGeneratedAbelianGroup(2,{2,56})
mLatticePoints=method()
mLatticePoints(List):=(L)->(
L1:=toString apply(L,entries);
-------------------------
mapleprogram:=
///
libname0:=libname:
libname:=libname0,placeholder2;
with(convex):
latticePoints:=proc(L)
local j,L1,C,H,n;
L1:=[];
for j from 1 to nops(L) do
L1:=[op(L1),[op(L[j]),1]];
od:
C:=poshull(op(L1));
print(C);
H:=hilbertbasis(C);
print(H);
n:=nops(L[1]);
L1:=[];
for j from 1 to nops(H) do
if H[j][n+1]=1 then L1:=[op(L1),[seq(H[j][jj],jj=1..n)]];fi;
od:
return(L1);
end proc:
returnvalue:=latticePoints(placeholder1);
///;
--------------------------
Lfc:=callMaple(L1,pathconvex,mapleprogram);
apply(Lfc,j->vector j))
-*
L={vector {3,-1,-1},vector {-1,3,-1},vector {-1,-1,3},vector {-1,-1,-1}};
P=mLatticePoints(L)
*-
-*
Copyright (C) [2009] [Janko Boehm]
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
*-
beginDocumentation()
doc ///
Key
ConvexInterface
Headline
Interface to the Maple package Convex.
Description
Text
{\bf What's new:}
{\it July 13, 2010:}
Added a function @TO mIsSubcone@ testing whether a cone is a subcone of another one.
{\it October 4, 2009:}
Added a generic function @TO callConvex@ taking a string with a program written in Convex syntax.
{\it September 20, 2009:}
Added functions @TO mPosHullFaces@ and @TO mPosHullFacesAndDuals@ to compute the face complex of a cone.
They have an @TO Option@ @TO toFile@ to store the result of a computation
in a file, and a function @TO readPosHullFaces@ to read the file.
{\it September 10, 2009:}
Added a function @TO mLatticePoints@ to compute the lattice points of polytope.
{\it August 28, 2009:}
The interface now uses indexed vertices. This substantially improves computation time and memory usage.
{\it August 25, 2009:}
Added an @TO Option@ @TO toFile@ to @TO mConvexHullFaces@ and @TO mConvexHullFacesAndDuals@ to store the result of a computation
in a file, and a function @TO readConvexHullFaces@ to read the file.
{\bf Overview:}
The goal of this package is to provide the functions of the Maple package Convex in Macaulay 2.
The Convex package is distributed by Matthias Franz under the GNU General Public License, see
@HREF"http://www.math.uwo.ca/~mfranz/convex"@
for more information.
ConvexInterface is work in progress and so far accesses only a fraction of the functionality provided by Convex.
If you would like to help to expand this you are welcome.
Note that there is a generic function @TO callConvex@ with takes a String containing a program written in the Syntax of Maple/Convex.
{\bf Functions:}
So far the following functions are accessible via ConvexInterface:
@TO mConvexHullFaces@ -- compute the faces of a convex hull
@TO mConvexHullFacesAndDuals@ -- computing the faces and their duals
@TO mHomology@ -- Compute the homology of a (not necessarily simplicial) complex
@TO mLatticePoints@ -- computing the lattice points of a convex hull
@TO mPosHullFaces@ -- compute the faces of a positive hull
@TO mPosHullFacesAndDuals@ -- computing the faces and their duals of a positive hull
Other functions that may be interesting to access:
dual, hilbertbasis, simplicialsubdiv, minkowskisum, newtonpolytope
and also
affinehull, ambientdim, arecompatible, boundary, codim, contains, containsrelint, convhull, corank, corners, crosspolytope, cube, cyclicpolytope, delaunay, dim, directsum, distance, domain, dotprod, draw, dual, edges, emptypcomplex, emptypolyhedron, emptypolytope, facefan, faces, facets, fan, flagf, flagh, fullcone, fullpolyhedron, furthestdelaunay, fvector, genhpolynomial, genhvector, hilbertbasis, homology, hplanes, hspacenos, hspaces, hvector, image, incidencematrix, incidentfacets, incidentrays, intersection, isaffine, isbounded, iscomplete, iscontained, isempty, isface, isfulldim, islinear, ispointed, ispolytopal, isquasipolytopal, isregular, issimple, issimplex, issimplicial, issimplicial1, join, lensspace, lineality, linearhull, lines, maximal, maximum, minimal, minimum, minkowskisum, modz, newtonpolytope, normalfan, pcomplex, permutahedron, plotdata, polar, poshull, posorthant, pred, preimage, projspace, proximum, randompolytope, rank, raynos, rays, readpoly, recession, regularpart, regularsubdiv, relint, simplicialsubdiv, skeleton, stdsimplex, stellarsubdiv, succ, support, surface, torsion, transversalfan, traverse, traverse2, vertexnos, vertices, volume, voronoi, wprojspace, writepoly, zerocone, zerofan
{\bf Setup:}
This package needs the package @TO MapleInterface@, so set this up first.
Install the convex package in Maple, i.e., put the file
@HREF"http://www.math.uwo.ca/~mfranz/convex/files/current/convex.m"@
into the lib directory inside your Maple program directory. You can test it in Maple by typing {\it with(convex);}
Install the {\it ConvexInterface} package in M2 by typing
installPackage("ConvexInterface")
{\bf Additional remarks:}
You can put the convex.m file in any directory which shows up when you type in Maple
libname;
You can change this global variable by editing the Maple init file.
You can also put the convex.m file in any directory you want, as long as you
tell M2 about the path. In this case the installation goes as follows: Do
installPackage("MapleInterface")
Edit the file init-ConvexInterface.m2 in the directory .Macaulay2 in your home directory
changing the line
"ConvexPath" =""
to
"ConvexPath" =StringWithPathToConvex
where StringWithPathToConvex is a string containing the path to the
directory containing the convex.m file.
In Unix type systems this will be something like
"/home/boehm/convex"
In Windows systems use double backslashes to separate directories
and the triple-slash as string delimiter. See the beginning of the source code for an example.
To test whether the interface is set up properly do, e.g.,
callConvex("returnvalue:=convert(fvector(convhull([1,0],[0,1],[-1,0],[0,-1])),list);")
which should return \{1,4,4,1\}.
///
doc ///
Key
mConvexHullFaces
(mConvexHullFaces,List)
Headline
Faces of a convex hull.
Usage
mConvexHullFaces(L)
Inputs
L:List
of @TO Vector@s
Outputs
:List
Description
Text
Returns a list of
- a @TO Matrix@ A with the vertices of the convex hull of L in its rows
- a list of lists with the faces of the convex hull sorted by increasing dimension.
The vertices of the faces are represented by the indices of the rows of A.
This uses the Convex functions convHull and faces.
Example
L={vector {1,0,0},vector {-1,0,0},vector {0,1,0},vector {0,-1,0},vector {0,0,1},vector {0,0,-1}}
P=mConvexHullFaces(L)
///
doc ///
Key
mConvexHullFacesAndDuals
(mConvexHullFacesAndDuals,List)
Headline
Faces and their duals of a convex hull.
Usage
mConvexHullFacesAndDuals(L)
Inputs
L:List
of @TO Vector@s
Outputs
:List
Description
Text
Returns a list of
- a @TO Matrix@ A with the vertices of the convex hull of L in its rows
- a @TO Matrix@ Adual with the vertices of the dual in its rows
- a list of lists with the faces of the convex hull sorted by increasing dimension.
Each face is a list with two elements. The first is a list of the vertices of the face, the second a list of the vertices of the dual face.
The vertices of the faces are represented by the indices of the rows of A.
This requires that the convex hull of L contains 0 in its interior.
This uses the Convex functions convHull and faces.
Example
L={vector {1,0,0},vector {-1,0,0},vector {0,1,0},vector {0,-1,0},vector {0,0,1},vector {0,0,-1}}
P=mConvexHullFacesAndDuals(L)
///
doc ///
Key
mPosHullFaces
(mPosHullFaces,List)
Headline
Faces of a positive hull.
Usage
mPosHullFaces(L)
Inputs
L:List
of @TO Vector@s
Outputs
:List
Description
Text
Returns a list of
- a @TO Matrix@ A with the rays of the positive hull of L in its rows
- a list of lists with the faces of the convex hull sorted by increasing dimension.
The rays of the faces are represented by the indices of the rows of A.
This uses the Convex functions posHull and faces.
The positive hull of L is required to be strictly convex.
Example
L= {{0,1,1,0,0},{0,1,0,1,0},{0,1,0,0,0},{1,0,0,0,1},{1,0,-1,-1,-1},{1,0,0,0,0}};
L=apply(L,vector)
P=mPosHullFaces(L)
///
doc ///
Key
mPosHullFacesAndDuals
(mPosHullFacesAndDuals,List)
Headline
Faces and their duals of positive hull.
Usage
mPosHullFacesAndDuals(L)
Inputs
L:List
of @TO Vector@s
Outputs
:List
Description
Text
Returns a list of
- a @TO Matrix@ A with the rays of the positive hull of L in its rows
- a @TO Matrix@ Adual with the rays of the dual in its rows
- a list of lists with the faces of the positive hull sorted by increasing dimension.
Each face is a list with two elements. The first is a list of the vertices of the face, the second a list of the vertices of the dual face.
The rays of the faces are represented by the indices of the rows of A.
This uses the Convex functions posHull and faces.
The positive hull of L is required to be strictly convex and of full dimension.
Example
L= {{0,1,1,0,0},{0,1,0,1,0},{0,1,0,0,0},{1,0,0,0,1},{1,0,-1,-1,-1},{1,0,0,0,0}};
L=apply(L,vector)
P=mPosHullFacesAndDuals(L)
///
doc ///
Key
mHomology
(mHomology,List)
Headline
Compute the homology.
Usage
mHomology(C)
Inputs
C:List
of lists with the faces of a complex, sorted by dimension, each face represented by a list of vertices.
Outputs
:List
Description
Text
Returns a list of @TO FinitelyGeneratedAbelianGroup@s with the homology with closed support of C with integer coefficients.
C does not have to be simplicial.
This uses the Convex functions convHull, simplicialsubdiv, pcomplex and homology.
Remark: One should also implement the relative version from Convex.
Example
C={{{}}, {{{-1, -1, -1, -1}}, {{1, 0, 0, 0}}, {{0, 1, 0, 0}}, {{0, 0, 1,0}}, {{0, 0, 0, 1}}}, {{{-1, -1, -1, -1}, {0, 1, 0, 0}}, {{-1, -1, -1,-1}, {0, 0, 1, 0}}, {{1, 0, 0, 0}, {0, 0, 1, 0}}, {{1, 0, 0, 0}, {0, 0, 0,1}}, {{0, 1, 0, 0}, {0, 0, 0, 1}}}, {}, {}, {}};
mHomology(C)
Text
RP2:
Example
C= {{{}}, {{{-1, -1, -1, -1, -1}}, {{1, 0, 0, 0, 0}}, {{0, 1, 0, 0, 0}}, {{0, 0, 1, 0, 0}}, {{0, 0, 0, 1, 0}}, {{0, 0, 0, 0, 1}}}, {{{-1, -1, -1, -1,-1}, {1, 0, 0, 0, 0}}, {{-1, -1, -1, -1, -1}, {0, 1, 0, 0, 0}}, {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}}, {{-1, -1, -1, -1, -1}, {0, 0, 1, 0, 0}}, {{1, 0, 0, 0, 0}, {0, 0, 1, 0, 0}}, {{0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}}, {{-1, -1, -1, -1, -1}, {0, 0, 0, 1, 0}}, {{1, 0, 0, 0, 0}, {0, 0, 0, 1, 0}}, {{0, 1, 0, 0, 0}, {0, 0, 0, 1, 0}}, {{0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}}, {{-1, -1, -1, -1, -1}, {0, 0, 0, 0, 1}}, {{1, 0, 0, 0, 0}, {0, 0, 0, 0, 1}}, {{0, 1, 0, 0, 0}, {0, 0, 0, 0, 1}}, {{0, 0, 1, 0, 0}, {0, 0, 0, 0, 1}}, {{0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}}, {{{-1, -1, -1, -1, -1}, {1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}}, {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}}, {{-1, -1, -1, -1, -1}, {1, 0, 0, 0, 0}, {0, 0, 0, 1, 0}}, {{-1, -1, -1, -1, -1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}}, {{0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}}, {{-1, -1, -1, -1, -1}, {0, 1, 0, 0, 0}, {0, 0, 0, 0, 1}}, {{-1, -1, -1, -1, -1}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 1}}, {{1, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 1}}, {{1, 0, 0, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}, {{0, 1, 0, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}}, {}, {}, {}};
mHomology(C)
///
doc ///
Key
mLatticePoints
(mLatticePoints,List)
Headline
Compute the lattice points of a convex hull.
Usage
mLatticePoints(L)
Inputs
L:List
of @TO Vector@s.
Outputs
:List
Description
Text
Returns a list with the lattice points of the convex hull of L.
This uses the Convex functions convHull and hilbertbasis.
Example
L={vector {3,-1,-1},vector {-1,3,-1},vector {-1,-1,3},vector {-1,-1,-1}};
P=mLatticePoints(L)
///
doc ///
Key
FinitelyGeneratedAbelianGroup
(net,FinitelyGeneratedAbelianGroup)
Headline
Class of finitely generated abelian groups.
Description
Text
The class of finitely generated abelian groups (finitely generated ZZ-modules).
This is used to store the result of @TO mHomology@ in a nice way.
Example
C= {{{}}, {{{-1, -1, -1, -1, -1}}, {{1, 0, 0, 0, 0}}, {{0, 1, 0, 0, 0}}, {{0, 0, 1, 0, 0}}, {{0, 0, 0, 1, 0}}, {{0, 0, 0, 0, 1}}}, {{{-1, -1, -1, -1,-1}, {1, 0, 0, 0, 0}}, {{-1, -1, -1, -1, -1}, {0, 1, 0, 0, 0}}, {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}}, {{-1, -1, -1, -1, -1}, {0, 0, 1, 0, 0}}, {{1, 0, 0, 0, 0}, {0, 0, 1, 0, 0}}, {{0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}}, {{-1, -1, -1, -1, -1}, {0, 0, 0, 1, 0}}, {{1, 0, 0, 0, 0}, {0, 0, 0, 1, 0}}, {{0, 1, 0, 0, 0}, {0, 0, 0, 1, 0}}, {{0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}}, {{-1, -1, -1, -1, -1}, {0, 0, 0, 0, 1}}, {{1, 0, 0, 0, 0}, {0, 0, 0, 0, 1}}, {{0, 1, 0, 0, 0}, {0, 0, 0, 0, 1}}, {{0, 0, 1, 0, 0}, {0, 0, 0, 0, 1}}, {{0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}}, {{{-1, -1, -1, -1, -1}, {1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}}, {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}}, {{-1, -1, -1, -1, -1}, {1, 0, 0, 0, 0}, {0, 0, 0, 1, 0}}, {{-1, -1, -1, -1, -1}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}}, {{0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}}, {{-1, -1, -1, -1, -1}, {0, 1, 0, 0, 0}, {0, 0, 0, 0, 1}}, {{-1, -1, -1, -1, -1}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 1}}, {{1, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 1}}, {{1, 0, 0, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}, {{0, 1, 0, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}}, {}, {}, {}}
H=mHomology(C)
H#0
H#1
///
doc ///
Key
mIsSubcone
(mIsSubcone,List,List)
Headline
Test whether a cone is a subcone of another cone.
Usage
mIsSubcone(L1,L2)
Inputs
L1:List
of vectors generating the cone C1
L2:List
of vectors generating the cone C2
Outputs
:Boolean
Description
Text
Test whether C1 is a subcone of C2.
Example
L1={{1,0},{0,1}};
L1=apply(L1,vector)
L2={{1,2},{2,1}};
L2=apply(L2,vector)
mIsSubcone(L1,L2)
mIsSubcone(L2,L1)
///
doc ///
Key
toFile
[callConvex,toFile]
[mConvexHullFaces,toFile]
[mConvexHullFacesAndDuals,toFile]
[mPosHullFaces,toFile]
[mPosHullFacesAndDuals,toFile]
[mIsSubcone,toFile]
Headline
Store result in a file.
Description
Text
If the option toFile=>fn with a @TO String@ fn is given
then @TO mConvexHullFacesAndDuals@ stores the result in a file named fn.
This data can be read by the commands @TO readConvexHullFaces@ and @TO readPosHullFaces@.
///
doc ///
Key
readConvexHullFaces
(readConvexHullFaces,String)
Headline
Read the result of a previous mConvexHullFaces or mConvexHullFacesAndDuals computation.
Usage
readConvexHullFaces(L)
Inputs
fn:String
Outputs
:List
Description
Text
Read from the file fn the result of a previous @TO mConvexHullFaces@ or @TO mConvexHullFacesAndDuals@ computation stored via the @TO Option@ @TO toFile@.
///
doc ///
Key
readPosHullFaces
(readPosHullFaces,String)
Headline
Read the result of a previous mPosHullFaces or mPosHullFacesAndDuals computation.
Usage
readConvexHullFaces(L)
Inputs
fn:String
Outputs
:List
Description
Text
Read from the file fn the result of a previous @TO mPosHullFacesAndDuals@ or @TO mPosHullFaces@ computation stored via the @TO Option@ @TO toFile@.
///
doc ///
Key
callConvex
(callConvex,String)
Headline
Generic function to run a Convex program.
Usage
callConvex(S)
Inputs
S:String
Outputs
:Thing
Description
Text
This is a generic function to run a Convex program given by the string S.
The result of the computation can be stored in a file via the @TO Option@ @TO toFile@.
Example
callConvex("returnvalue:=convert(fvector(convhull([1,0],[0,1],[-1,0],[0,-1])),list);")
///
-*
installPackage("ConvexInterface",RerunExamples=>true);
*-
|