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 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848
|
# Copyright (c) 1997-2024
# Ewgenij Gawrilow, Michael Joswig, and the polymake team
# Technische Universität Berlin, Germany
# https://polymake.org
#
# 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, or (at your option) any
# later version: http://www.gnu.org/licenses/gpl.txt.
#
# 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.
#-------------------------------------------------------------------------------
function induced_orbits<Scalar>(Cone<Scalar> $$ { homog_action=>0 }) {
my ($c, $action_name, $generator_name, $options) = @_;
return group::induced_orbits_impl($c, $action_name, $generator_name, (new Scalar()), $options);
}
function induced_orbits_on_vectors<Scalar>(Array<Matrix<Scalar>>, Matrix<Scalar>) {
my ($gens, $vecs) = @_;
return group::induced_orbits_on_vectors_impl<Scalar>($gens, $vecs);
}
object Cone {
# @category Symmetry
property GROUP : group::Group : multiple {
# @category Symmetry
property MATRIX_ACTION : group::MatrixActionOnVectors<Scalar> {
# @category Symmetry
property RAYS_ORBITS = override VECTORS_ORBITS;
};
# @category Symmetry
property REPRESENTATIVE_RAYS : Matrix<Scalar>;
# @category Symmetry
property REPRESENTATIVE_FACETS : Matrix<Scalar>;
}
}
object Cone<Float> {
rule GROUP.MATRIX_ACTION.IRREDUCIBLE_DECOMPOSITION : GROUP.MATRIX_ACTION.CHARACTER, GROUP.CHARACTER_TABLE, GROUP.CONJUGACY_CLASS_SIZES, GROUP.ORDER {
$this->GROUP->MATRIX_ACTION->IRREDUCIBLE_DECOMPOSITION = group::irreducible_decomposition(new Vector<Float>($this->GROUP->MATRIX_ACTION->CHARACTER), $this->GROUP);
}
weight 1.10;
}
object Cone {
property GROUP {
# First, some rules that apply to all actions
rule ORDER : RAYS_ACTION.TRANSVERSAL_SIZES | FACETS_ACTION.TRANSVERSAL_SIZES | HOMOGENEOUS_COORDINATE_ACTION.TRANSVERSAL_SIZES {
my $arr = $this->give("RAYS_ACTION.TRANSVERSAL_SIZES | FACETS_ACTION.TRANSVERSAL_SIZES | HOMOGENEOUS_COORDINATE_ACTION.TRANSVERSAL_SIZES");
my $i = new Integer(1);
$i *= $_ foreach(@{$arr});
$this->ORDER = $i;
}
weight 1.10;
rule CONJUGACY_CLASS_SIZES : RAYS_ACTION.CONJUGACY_CLASSES | FACETS_ACTION.CONJUGACY_CLASSES | \
HOMOGENEOUS_COORDINATE_ACTION.CONJUGACY_CLASSES | SET_ACTION.CONJUGACY_CLASSES | MATRIX_ACTION.CONJUGACY_CLASSES {
my $arr = $this->give("RAYS_ACTION.CONJUGACY_CLASSES | FACETS_ACTION.CONJUGACY_CLASSES | HOMOGENEOUS_COORDINATE_ACTION.CONJUGACY_CLASSES | SET_ACTION.CONJUGACY_CLASSES | MATRIX_ACTION.CONJUGACY_CLASSES");
$this->CONJUGACY_CLASS_SIZES = [ map {$_->size} @{$arr} ];
}
weight 1.10;
# *_ACTION->IRREDUCIBLE_DECOMPOSITION, in alphabetical order
rule HOMOGENEOUS_COORDINATE_ACTION.IRREDUCIBLE_DECOMPOSITION : HOMOGENEOUS_COORDINATE_ACTION.CHARACTER, CHARACTER_TABLE, CONJUGACY_CLASS_SIZES, ORDER {
$this->HOMOGENEOUS_COORDINATE_ACTION->IRREDUCIBLE_DECOMPOSITION = group::irreducible_decomposition($this->HOMOGENEOUS_COORDINATE_ACTION->CHARACTER, $this);
}
weight 1.10;
rule FACETS_ACTION.IRREDUCIBLE_DECOMPOSITION : FACETS_ACTION.CHARACTER, CHARACTER_TABLE, CONJUGACY_CLASS_SIZES, ORDER {
$this->FACETS_ACTION->IRREDUCIBLE_DECOMPOSITION = group::irreducible_decomposition($this->FACETS_ACTION->CHARACTER, $this);
}
weight 1.10;
rule MATRIX_ACTION.IRREDUCIBLE_DECOMPOSITION : MATRIX_ACTION.CHARACTER, CHARACTER_TABLE, CONJUGACY_CLASS_SIZES, ORDER {
$this->MATRIX_ACTION->IRREDUCIBLE_DECOMPOSITION = group::irreducible_decomposition($this->MATRIX_ACTION->CHARACTER, $this);
}
weight 1.10;
rule RAYS_ACTION.IRREDUCIBLE_DECOMPOSITION : RAYS_ACTION.CHARACTER, CHARACTER_TABLE, CONJUGACY_CLASS_SIZES, ORDER {
$this->RAYS_ACTION->IRREDUCIBLE_DECOMPOSITION = group::irreducible_decomposition($this->RAYS_ACTION->CHARACTER, $this);
}
weight 1.10;
rule SET_ACTION.IRREDUCIBLE_DECOMPOSITION : SET_ACTION.CHARACTER, CHARACTER_TABLE, CONJUGACY_CLASS_SIZES, ORDER {
$this->SET_ACTION->IRREDUCIBLE_DECOMPOSITION = group::irreducible_decomposition($this->SET_ACTION->CHARACTER, $this);
}
weight 1.10;
#
# some shortcuts
#
# @category Symmetry
# explicit representatives of equivalence classes of [[polytope::INPUT_RAYS]] under a group action
# @return Matrix
user_method REPRESENTATIVE_INPUT_RAYS = INPUT_RAYS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX;
# @category Symmetry
# explicit representatives of equivalence classes of [[polytope::Cone::INEQUALITIES|INEQUALITIES]] under a group action
# @return Matrix
user_method REPRESENTATIVE_INEQUALITIES = INEQUALITIES_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX;
rule REPRESENTATIVE_RAYS = RAYS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX;
rule REPRESENTATIVE_FACETS = FACETS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX;
}
#
# Next, some specific rules
#
rule GROUP.SET_ACTION.INDEX_OF : GROUP.SET_ACTION.DOMAIN_NAME, MAX_INTERIOR_SIMPLICES | INTERIOR_RIDGE_SIMPLICES {
my $dom = $this->GROUP->SET_ACTION->DOMAIN_NAME;
$this->GROUP->SET_ACTION->INDEX_OF(temporary) = index_of($this->$dom);
}
weight 1.10;
#
# explicit representatives
#
rule GROUP.SET_ACTION.EXPLICIT_ORBIT_REPRESENTATIVES : GROUP.SET_ACTION.DOMAIN_NAME, GROUP.SET_ACTION.ORBIT_REPRESENTATIVES, MAX_INTERIOR_SIMPLICES | INTERIOR_RIDGE_SIMPLICES {
my $domain_name = $this->GROUP->SET_ACTION->DOMAIN_NAME;
my @reps = map { $this->$domain_name->[$_] } @{$this->GROUP->SET_ACTION->ORBIT_REPRESENTATIVES};
$this->GROUP->SET_ACTION->EXPLICIT_ORBIT_REPRESENTATIVES = \@reps;
}
weight 1.10;
rule GROUP.INPUT_RAYS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.INPUT_RAYS_ACTION.ORBIT_REPRESENTATIVES, INPUT_RAYS {
$this->GROUP->INPUT_RAYS_ACTION->EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX = $this->INPUT_RAYS->minor($this->GROUP->INPUT_RAYS_ACTION->ORBIT_REPRESENTATIVES, All);
}
weight 1.10;
rule GROUP.RAYS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.RAYS_ACTION.ORBIT_REPRESENTATIVES, RAYS {
$this->GROUP->RAYS_ACTION->EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX = $this->RAYS->minor($this->GROUP->RAYS_ACTION->ORBIT_REPRESENTATIVES, All);
}
weight 1.10;
rule GROUP.FACETS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.FACETS_ACTION.ORBIT_REPRESENTATIVES, FACETS {
$this->GROUP->FACETS_ACTION->EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX = $this->FACETS->minor($this->GROUP->FACETS_ACTION->ORBIT_REPRESENTATIVES, All);
}
weight 1.10;
rule GROUP.MATRIX_ACTION.RAYS_ORBITS : GROUP.MATRIX_ACTION.GENERATORS, RAYS {
$this->GROUP->MATRIX_ACTION->RAYS_ORBITS = group::induced_orbits_on_vectors_impl($this->GROUP->MATRIX_ACTION->GENERATORS, $this->RAYS);
}
weight 2.10;
#
# induce actions from others
#
#
# induce RAYS_ACTION
#
rule GROUP.INPUT_RAYS_ACTION.GENERATORS : GROUP.HOMOGENEOUS_COORDINATE_ACTION.GENERATORS, INPUT_RAYS {
$this->GROUP->INPUT_RAYS_ACTION = group::induce_permutation_action($this, "HOMOGENEOUS_COORDINATE_ACTION", "INPUT_RAYS", "input_ray_action", "induced from coordinate action", 1);
}
weight 1.10;
rule GROUP.INPUT_RAYS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES: GROUP.HOMOGENEOUS_COORDINATE_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, INPUT_RAYS {
$this->GROUP->INPUT_RAYS_ACTION->CONJUGACY_CLASS_REPRESENTATIVES = group::induced_permutations($this->GROUP->HOMOGENEOUS_COORDINATE_ACTION->CONJUGACY_CLASS_REPRESENTATIVES, $this->INPUT_RAYS, homogeneous_action=>1);
}
weight 1.10;
rule GROUP.RAYS_ACTION.GENERATORS : GROUP.FACETS_ACTION.GENERATORS, FACETS_THRU_RAYS {
$this->GROUP->RAYS_ACTION = group::induce_permutation_action($this, "FACETS_ACTION", "FACETS_THRU_RAYS", "ray_action", "induced from facet action", 0);
}
weight 1.10;
rule GROUP.RAYS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES: GROUP.FACETS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, FACETS_THRU_RAYS {
$this->GROUP->RAYS_ACTION->CONJUGACY_CLASS_REPRESENTATIVES = group::induced_permutations($this->GROUP->FACETS_ACTION->CONJUGACY_CLASS_REPRESENTATIVES, $this->FACETS_THRU_RAYS, homogeneous_action=>0);
}
weight 1.10;
rule GROUP.RAYS_ACTION.GENERATORS : GROUP.HOMOGENEOUS_COORDINATE_ACTION.GENERATORS, RAYS {
$this->GROUP->RAYS_ACTION = group::induce_permutation_action($this, "HOMOGENEOUS_COORDINATE_ACTION", "RAYS", "ray_action", "induced from homogeneous coordinate action", 1);
}
weight 1.10;
rule GROUP.RAYS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES: GROUP.HOMOGENEOUS_COORDINATE_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, RAYS {
$this->GROUP->RAYS_ACTION->CONJUGACY_CLASS_REPRESENTATIVES = group::induced_permutations($this->GROUP->HOMOGENEOUS_COORDINATE_ACTION->CONJUGACY_CLASS_REPRESENTATIVES, $this->RAYS, homogeneous_action=>1);
}
weight 1.10;
#
# induce FACETS_ACTION
#
rule GROUP.FACETS_ACTION.GENERATORS : GROUP.RAYS_ACTION.GENERATORS, RAYS_IN_FACETS {
$this->GROUP->FACETS_ACTION = group::induce_permutation_action($this, "RAYS_ACTION", "RAYS_IN_FACETS", "facet_action", "induced from ray action", 0);
}
weight 1.10;
rule GROUP.FACETS_ACTION.GENERATORS : GROUP.HOMOGENEOUS_COORDINATE_ACTION.GENERATORS, FACETS {
$this->GROUP->FACETS_ACTION = group::induce_permutation_action($this, "HOMOGENEOUS_COORDINATE_ACTION", "FACETS", "facet_action", "induced from homogeneous coordinate action", 1, \&canonicalize_facets);
}
weight 1.10;
rule GROUP.FACETS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES: GROUP.RAYS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, RAYS_IN_FACETS {
$this->GROUP->FACETS_ACTION->CONJUGACY_CLASS_REPRESENTATIVES = group::induced_permutations($this->GROUP->RAYS_ACTION->CONJUGACY_CLASS_REPRESENTATIVES, $this->RAYS_IN_FACETS, homogeneous_action=>0);
}
weight 1.10;
rule GROUP.FACETS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES: GROUP.HOMOGENEOUS_COORDINATE_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, FACETS {
$this->GROUP->FACETS_ACTION->CONJUGACY_CLASS_REPRESENTATIVES = group::induced_permutations($this->GROUP->HOMOGENEOUS_COORDINATE_ACTION->CONJUGACY_CLASS_REPRESENTATIVES, $this->FACETS, homogeneous_action=>1);
}
weight 1.10;
#
# induce MATRIX_ACTION
#
sub induced_matrix_action_kernel {
my $this = shift;
my $kernel = new Matrix<Scalar>;
if (defined(my $ls = $this->lookup("LINEAR_SPAN"))) {
$kernel /= $ls;
}
if (defined(my $ls = $this->lookup("LINEALITY_SPACE"))) {
$kernel /= $ls;
}
return $kernel;
}
rule GROUP.MATRIX_ACTION.GENERATORS : GROUP.INPUT_RAYS_ACTION.GENERATORS, INPUT_RAYS {
group::induce_matrix_action_generators($this, "MATRIX_ACTION", "INPUT_RAYS_ACTION", "INPUT_RAYS", induced_matrix_action_kernel($this));
}
rule GROUP.MATRIX_ACTION.CONJUGACY_CLASS_REPRESENTATIVES : GROUP.INPUT_RAYS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, INPUT_RAYS {
group::induce_matrix_action_conjugacy_class_representatives($this, "MATRIX_ACTION", "INPUT_RAYS_ACTION", "INPUT_RAYS", induced_matrix_action_kernel($this));
}
rule GROUP.MATRIX_ACTION.GENERATORS : GROUP.RAYS_ACTION.GENERATORS, RAYS {
group::induce_matrix_action_generators($this, "MATRIX_ACTION", "RAYS_ACTION", "RAYS", induced_matrix_action_kernel($this));
}
rule GROUP.MATRIX_ACTION.CONJUGACY_CLASS_REPRESENTATIVES : GROUP.RAYS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, RAYS {
group::induce_matrix_action_conjugacy_class_representatives($this, "MATRIX_ACTION", "RAYS_ACTION", "RAYS", induced_matrix_action_kernel($this));
}
rule GROUP.MATRIX_ACTION.GENERATORS : GROUP.INEQUALITIES_ACTION.GENERATORS, INEQUALITIES {
group::induce_matrix_action_generators($this, "MATRIX_ACTION", "INEQUALITIES_ACTION", "INEQUALITIES", induced_matrix_action_kernel($this));
}
rule GROUP.MATRIX_ACTION.CONJUGACY_CLASS_REPRESENTATIVES : GROUP.INEQUALITIES_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, INEQUALITIES {
group::induce_matrix_action_conjugacy_class_representatives($this, "MATRIX_ACTION", "INEQUALITIES_ACTION", "INEQUALITIES", induced_matrix_action_kernel($this));
}
rule GROUP.MATRIX_ACTION.GENERATORS : GROUP.FACETS_ACTION.GENERATORS, FACETS {
group::induce_matrix_action_generators($this, "MATRIX_ACTION", "FACETS_ACTION", "FACETS", induced_matrix_action_kernel($this));
}
rule GROUP.MATRIX_ACTION.CONJUGACY_CLASS_REPRESENTATIVES : GROUP.FACETS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, FACETS {
group::induce_matrix_action_conjugacy_class_representatives($this, "MATRIX_ACTION", "FACETS_ACTION", "FACETS", induced_matrix_action_kernel($this));
}
#
# Others
#
rule GROUP.INEQUALITIES_ACTION.GENERATORS: GROUP.HOMOGENEOUS_COORDINATE_ACTION.GENERATORS, INEQUALITIES {
$this->GROUP->INEQUALITIES_ACTION = group::induce_permutation_action($this, "HOMOGENEOUS_COORDINATE_ACTION", "INEQUALITIES", "inequalities_action", "induced from homogeneous coordinate action", 1, \&canonicalize_facets);
}
weight 1.10;
rule GROUP.INEQUALITIES_ACTION.CONJUGACY_CLASS_REPRESENTATIVES: GROUP.HOMOGENEOUS_COORDINATE_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, INEQUALITIES {
$this->GROUP->INEQUALITIES_ACTION->CONJUGACY_CLASS_REPRESENTATIVES = group::induced_permutations($this->GROUP->HOMOGENEOUS_COORDINATE_ACTION->CONJUGACY_CLASS_REPRESENTATIVES, $this->INEQUALITIES, homogeneous_action=>1);
}
weight 1.10;
#
# Orbits induced by coordinate actions
#
rule INPUT_RAYS, GROUP.INPUT_RAYS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.HOMOGENEOUS_COORDINATE_ACTION.GENERATORS, GROUP.HOMOGENEOUS_COORDINATE_ACTION.INPUT_RAYS_GENERATORS {
my ($pts, $a) = induced_orbits($this, "HOMOGENEOUS_COORDINATE_ACTION", "INPUT_RAYS_GENERATORS", homog_action => 1);
$this->INPUT_RAYS = $pts;
$this->GROUP->INPUT_RAYS_ACTION = $a;
}
weight 2.10;
# incurs PointsPerm;
rule INPUT_RAYS, GROUP.INPUT_RAYS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.MATRIX_ACTION.GENERATORS, GROUP.MATRIX_ACTION.INPUT_RAYS_GENERATORS {
my ($pts, $a) = induced_orbits($this, "MATRIX_ACTION", "INPUT_RAYS_GENERATORS", homog_action => 0);
$this->INPUT_RAYS = $pts;
$this->GROUP->INPUT_RAYS_ACTION = $a;
}
weight 2.10;
# incurs PointsPerm;
rule RAYS, GROUP.RAYS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.HOMOGENEOUS_COORDINATE_ACTION.GENERATORS, GROUP.HOMOGENEOUS_COORDINATE_ACTION.RAYS_GENERATORS {
my ($pts, $a) = induced_orbits($this, "HOMOGENEOUS_COORDINATE_ACTION", "RAYS_GENERATORS", homog_action => 1);
$this->RAYS = $pts;
$this->GROUP->RAYS_ACTION = $a;
}
weight 2.10;
incurs VertexPerm;
rule INEQUALITIES, GROUP.INEQUALITIES_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.HOMOGENEOUS_COORDINATE_ACTION.GENERATORS, GROUP.HOMOGENEOUS_COORDINATE_ACTION.INEQUALITIES_GENERATORS {
my ($pts, $a) = induced_orbits($this, "HOMOGENEOUS_COORDINATE_ACTION", "INEQUALITIES_GENERATORS", homog_action => 1);
$this->INEQUALITIES = $pts;
$this->GROUP->INEQUALITIES_ACTION = $a;
}
weight 2.10;
rule FACETS, GROUP.FACETS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.HOMOGENEOUS_COORDINATE_ACTION.GENERATORS, GROUP.HOMOGENEOUS_COORDINATE_ACTION.FACETS_GENERATORS {
my ($pts, $a) = induced_orbits($this, "HOMOGENEOUS_COORDINATE_ACTION", "FACETS_GENERATORS", homog_action => 1);
$this->FACETS = $pts;
$this->GROUP->FACETS_ACTION = $a;
}
weight 2.10;
incurs FacetPerm;
}
object Polytope {
property GROUP {
# @category Symmetry
property VERTICES_ACTION = override RAYS_ACTION;
# @category Symmetry
property COORDINATE_ACTION = override HOMOGENEOUS_COORDINATE_ACTION {
property POINTS_GENERATORS = override INPUT_RAYS_GENERATORS;
property N_POINTS_GENERATORS = override N_INPUT_RAYS_GENERATORS;
property VERTICES_GENERATORS = override RAYS_GENERATORS;
property N_VERTICES_GENERATORS = override N_RAYS_GENERATORS;
}
# @category Symmetry
property POINTS_ACTION = override INPUT_RAYS_ACTION;
# @category Symmetry
property MATRIX_ACTION {
property VERTICES_ORBITS = override VECTORS_ORBITS;
};
# @category Symmetry
property REPRESENTATIVE_VERTICES = override REPRESENTATIVE_RAYS;
rule ORDER : VERTICES_ACTION.TRANSVERSAL_SIZES | FACETS_ACTION.TRANSVERSAL_SIZES | COORDINATE_ACTION.TRANSVERSAL_SIZES {
my $order = new Integer(1);
$order *= $_ foreach(@{$this->lookup("VERTICES_ACTION.TRANSVERSAL_SIZES | FACETS_ACTION.TRANSVERSAL_SIZES | COORDINATE_ACTION.TRANSVERSAL_SIZES")});
$this->ORDER = $order;
}
weight 1.10;
user_method REPRESENTATIVE_INEQUALITIES = INEQUALITY_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX;
}
rule GROUP.POINTS_ACTION.GENERATORS: GROUP.COORDINATE_ACTION.GENERATORS, POINTS {
$this->GROUP->POINTS_ACTION = group::induce_permutation_action($this, "COORDINATE_ACTION", "POINTS", "points_action", "induced from coordinate_action");
}
weight 1.10;
rule GROUP.POINTS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES: GROUP.COORDINATE_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, POINTS{
$this->GROUP->POINTS_ACTION->CONJUGACY_CLASS_REPRESENTATIVES = induced_permutations($this->GROUP->COORDINATE_ACTION->CONJUGACY_CLASS_REPRESENTATIVES, $this->POINTS, homogeneous_action=>0);
}
weight 1.10;
rule GROUP.POINTS_ACTION.GENERATORS = GROUP.PERMUTATION_ACTION.GENERATORS;
precondition : GROUP.PERMUTATION_ACTION.DEGREE, N_POINTS { $this->GROUP->PERMUTATION_ACTION->DEGREE == $this->N_POINTS }
rule GROUP.POINTS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES = GROUP.PERMUTATION_ACTION.CONJUGACY_CLASS_REPRESENTATIVES;
precondition : GROUP.PERMUTATION_ACTION.DEGREE, N_POINTS { $this->GROUP->PERMUTATION_ACTION->DEGREE == $this->N_POINTS }
rule GROUP.VERTICES_ACTION.GENERATORS : GROUP.COORDINATE_ACTION.GENERATORS, VERTICES {
$this->GROUP->VERTICES_ACTION = group::induce_permutation_action($this, "COORDINATE_ACTION", "VERTICES", "vertices_action", "induced from coordinate_action");
}
weight 1.10;
rule GROUP.VERTICES_ACTION.CONJUGACY_CLASS_REPRESENTATIVES: GROUP.COORDINATE_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, VERTICES {
$this->GROUP->VERTICES_ACTION->CONJUGACY_CLASS_REPRESENTATIVES = group::induced_permutations($this->GROUP->COORDINATE_ACTION->CONJUGACY_CLASS_REPRESENTATIVES, $this->VERTICES, homogeneous_action=>0);
}
weight 1.10;
rule GROUP.VERTICES_ACTION.GENERATORS = GROUP.PERMUTATION_ACTION.GENERATORS;
precondition : GROUP.PERMUTATION_ACTION.DEGREE, N_VERTICES { $this->GROUP->PERMUTATION_ACTION->DEGREE == $this->N_VERTICES }
rule GROUP.VERTICES_ACTION.CONJUGACY_CLASS_REPRESENTATIVES = GROUP.PERMUTATION_ACTION.CONJUGACY_CLASS_REPRESENTATIVES;
precondition : GROUP.PERMUTATION_ACTION.DEGREE, N_VERTICES { $this->GROUP->PERMUTATION_ACTION->DEGREE == $this->N_VERTICES }
rule GROUP.FACETS_ACTION.GENERATORS : GROUP.COORDINATE_ACTION.GENERATORS, FACETS {
$this->GROUP->FACETS_ACTION = group::induce_permutation_action($this, "COORDINATE_ACTION", "FACETS", "facets_action", "induced from coordinate_action", 0, \&canonicalize_facets);
}
weight 1.10;
rule GROUP.FACETS_ACTION.CONJUGACY_CLASS_REPRESENTATIVES: GROUP.COORDINATE_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, FACETS {
$this->GROUP->FACETS_ACTION->CONJUGACY_CLASS_REPRESENTATIVES = group::induced_permutations($this->GROUP->COORDINATE_ACTION->CONJUGACY_CLASS_REPRESENTATIVES, $this->FACETS, homogeneous_action=>0);
}
weight 1.10;
rule GROUP.INEQUALITIES_ACTION.GENERATORS : GROUP.COORDINATE_ACTION.GENERATORS, INEQUALITIES {
$this->GROUP->INEQUALITIES_ACTION = group::induce_permutation_action($this, "COORDINATE_ACTION", "INEQUALITIES", "inequalities_action", "induced from coordinate_action", 0, \&canonicalize_facets);
}
weight 1.10;
rule GROUP.INEQUALITIES_ACTION.CONJUGACY_CLASS_REPRESENTATIVES: GROUP.COORDINATE_ACTION.CONJUGACY_CLASS_REPRESENTATIVES, INEQUALITIES {
$this->GROUP->INEQUALITIES_ACTION->CONJUGACY_CLASS_REPRESENTATIVES = group::induced_permutations($this->GROUP->COORDINATE_ACTION->CONJUGACY_CLASS_REPRESENTATIVES, $this->INEQUALITIES, homogeneous_action=>1);
}
weight 1.10;
rule POINTS, GROUP.POINTS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.COORDINATE_ACTION.GENERATORS, GROUP.COORDINATE_ACTION.POINTS_GENERATORS {
my ($pts, $a) = induced_orbits($this, "COORDINATE_ACTION", "POINTS_GENERATORS", homog_action => 0);
$this->POINTS = $pts;
$this->GROUP->POINTS_ACTION = $a;
}
weight 2.10;
# incurs PointsPerm;
rule VERTICES, GROUP.VERTICES_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.COORDINATE_ACTION.GENERATORS, GROUP.COORDINATE_ACTION.VERTICES_GENERATORS {
my ($pts, $a) = induced_orbits($this, "COORDINATE_ACTION", "VERTICES_GENERATORS", homog_action => 0);
$this->VERTICES = $pts;
$this->GROUP->VERTICES_ACTION = $a;
}
weight 2.10;
incurs VertexPerm;
rule INEQUALITIES, GROUP.INEQUALITIES_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.COORDINATE_ACTION.GENERATORS, GROUP.COORDINATE_ACTION.INEQUALITIES_GENERATORS {
my ($pts, $a) = induced_orbits($this, "COORDINATE_ACTION", "INEQUALITIES_GENERATORS", homog_action => 0);
$this->INEQUALITIES = $pts;
$this->GROUP->INEQUALITIES_ACTION = $a;
}
weight 2.10;
rule FACETS, GROUP.FACETS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.COORDINATE_ACTION.GENERATORS, GROUP.COORDINATE_ACTION.FACETS_GENERATORS {
my ($pts, $a) = induced_orbits($this, "COORDINATE_ACTION", "FACETS_GENERATORS", homog_action => 0);
$this->FACETS = $pts;
$this->GROUP->FACETS_ACTION = $a;
}
weight 2.10;
incurs FacetPerm;
rule GROUP.VERTICES_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.VERTICES_ACTION.ORBIT_REPRESENTATIVES, VERTICES {
$this->GROUP->VERTICES_ACTION->EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX = $this->VERTICES->minor($this->GROUP->VERTICES_ACTION->ORBIT_REPRESENTATIVES, All);
}
rule GROUP.POINTS_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.POINTS_ACTION.ORBIT_REPRESENTATIVES, VERTICES {
$this->GROUP->POINTS_ACTION->EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX = $this->POINTS->minor($this->GROUP->POINTS_ACTION->ORBIT_REPRESENTATIVES, All);
}
weight 1.10;
rule GROUP.VERTICES_ACTION.EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX : GROUP.VERTICES_ACTION.ORBIT_REPRESENTATIVES, VERTICES {
$this->GROUP->VERTICES_ACTION->EXPLICIT_ORBIT_REPRESENTATIVE_MATRIX = $this->VERTICES->minor($this->GROUP->VERTICES_ACTION->ORBIT_REPRESENTATIVES, All);
}
weight 1.10;
# Generates an array with a specified number of different colors.
# @param Int number the number of colors
# @return array the colors as strings
sub generateColors {
my $number=$_[0];
# not really implemented yet!
my @FIFTEEN_COLORS=("chocolate1","salmon1","plum1","LightGreen","azure","LightSlateGrey","MidnightBlue","DarkOliveGreen","IndianRed","LavenderBlush","orange","green","red","blue","yellow");
my @colors=();
for(my $i=0;$i<$number;$i++) {
if($i<15) {
$colors[$i]=$FIFTEEN_COLORS[14-$i];
} else {
$colors[$i]="black";
}
}
return @colors;
}
# @category Visualization
# Visualizes the graph of a symmetric cone:
# All nodes belonging to one orbit get the same color.
# @return Visual::PolytopeGraph
user_method VISUAL_ORBIT_COLORED_GRAPH(%Visual::Graph::decorations, { seed => undef }) {
my ($this, $decor, $seed)=@_;
my $VG=$this->VISUAL_GRAPH($decor, $seed);
my @colors=generateColors($this->GROUP->RAYS_ACTION->N_ORBITS);
my @nodeColors;
for(my $i=0; $i<$this->GROUP->RAYS_ACTION->N_ORBITS; $i++){
foreach my $ray_index(@{$this->GROUP->RAYS_ACTION->ORBITS->[$i]}){
$nodeColors[$ray_index]=$colors[$i]; #each ray gets the color(=number) of its orbit
}
}
$VG->basis_graph->NodeColor=\@nodeColors;
visualize($VG);
}
} # end Polytope
object VectorConfiguration {
# @category Symmetry
property GROUP : group::Group : multiple {
# @category Symmetry
property MATRIX_ACTION : group::MatrixActionOnVectors<Scalar>;
# @category Symmetry
rule ORDER : VECTOR_ACTION.TRANSVERSAL_SIZES {
$this->ORDER = $this->order_from_transversals("VECTOR_ACTION.TRANSVERSAL_SIZES");
}
weight 1.10;
}
rule GROUP.CONJUGACY_CLASS_SIZES : GROUP.VECTOR_ACTION.CONJUGACY_CLASSES | GROUP.MATRIX_ACTION.CONJUGACY_CLASSES {
my $arr = $this->give("GROUP.VECTOR_ACTION.CONJUGACY_CLASSES | GROUP.MATRIX_ACTION.CONJUGACY_CLASSES");
$this->GROUP->CONJUGACY_CLASS_SIZES = [ map {$_->size} @{$arr} ];
}
weight 1.10;
rule GROUP.VECTOR_ACTION.GENERATORS = GROUP.PERMUTATION_ACTION.GENERATORS;
precondition : GROUP.PERMUTATION_ACTION.DEGREE, N_VECTORS { $this->GROUP->PERMUTATION_ACTION->DEGREE == $this->N_VECTORS }
rule GROUP.VECTOR_ACTION.CONJUGACY_CLASS_REPRESENTATIVES = GROUP.PERMUTATION_ACTION.CONJUGACY_CLASS_REPRESENTATIVES;
precondition : GROUP.PERMUTATION_ACTION.DEGREE, N_VECTORS { $this->GROUP->PERMUTATION_ACTION->DEGREE == $this->N_VECTORS }
rule GROUP.MATRIX_ACTION.GENERATORS : GROUP.VECTOR_ACTION.GENERATORS, VECTORS {
group::induce_matrix_action_generators($this, "MATRIX_ACTION", "VECTOR_ACTION", "VECTORS", new Matrix<Scalar>());
}
rule GROUP.MATRIX_ACTION.CONJUGACY_CLASS_REPRESENTATIVES : GROUP.VECTOR_ACTION.GENERATORS, VECTORS {
group::induce_matrix_action_conjugacy_class_representatives($this, "MATRIX_ACTION", "VECTOR_ACTION", "VECTORS", new Matrix<Scalar>());
}
rule GROUP.MATRIX_ACTION.IRREDUCIBLE_DECOMPOSITION : GROUP.MATRIX_ACTION.CHARACTER, GROUP.CHARACTER_TABLE, GROUP.CONJUGACY_CLASS_SIZES, GROUP.ORDER {
$this->GROUP->MATRIX_ACTION->IRREDUCIBLE_DECOMPOSITION = group::irreducible_decomposition($this->GROUP->MATRIX_ACTION->CHARACTER, $this->GROUP);
}
weight 1.10;
rule GROUP.MATRIX_ACTION.VECTORS_ORBITS : GROUP.MATRIX_ACTION.GENERATORS, VECTORS {
$this->GROUP->MATRIX_ACTION->VECTORS_ORBITS = group::induced_orbits_on_vectors_impl($this->GROUP->MATRIX_ACTION->GENERATORS, $this->VECTORS);
}
weight 2.10;
}
object PointConfiguration {
# @category Symmetry
property GROUP {
# @category Symmetry
property POINTS_ACTION = override VECTOR_ACTION;
property MATRIX_ACTION {
# @category Symmetry
property POINTS_ORBITS = override VECTORS_ORBITS;
};
}
}
# @category Symmetry
# Compute the combinatorial symmetries (i.e., automorphisms of the face lattice) of
# a given polytope //p//. They are stored in terms of a GROUP.VERTICES_ACTION and a GROUP.FACETS_ACTION
# property in //p//, and the GROUP.VERTICES_ACTION is also returned.
# @param Polytope p
# @return group::PermutationAction the action of the combinatorial symmetry group on the vertices
# @example To get the vertex symmetry group of the square and print its generators, type the following:
# > print combinatorial_symmetries(cube(2))->GENERATORS;
# | 2 3 0 1
# | 1 0 2 3
# > $p = cube(2); combinatorial_symmetries($p);
# > print $p->GROUP->VERTICES_ACTION->GENERATORS;
# | 0 2 1 3
# | 1 0 3 2
# > print $p->GROUP->FACETS_ACTION->GENERATORS;
# | 2 3 0 1
# | 1 0 2 3
user_function combinatorial_symmetries(polytope::Cone) {
my ($p) = @_;
return group::combinatorial_symmetries_impl($p, $p->RAYS_IN_FACETS, "FACETS_ACTION", "RAYS_ACTION");
}
# @category Symmetry
# Constructs the orbit polytope of a given point //input_point//
# with respect to a given group action //a//.
# @param Vector input_point the basis point of the orbit polytope
# @param group::PermutationAction a the action of a permutation group on the coordinates of the ambient space
# @return Polytope the orbit polytope of //input_point// w.r.t. the action //a//
# @example The //orbit polytope// of a set of points //A// in affine d-space is the convex hull of the images of //A// under the action of
# a group //G// on the affine space. polymake implements several variations of this concept. The most basic one is the convex hull of the
# orbit of a single point under a set of coordinate permutations.
# For example, consider the cyclic group //C_6// that acts on 6-dimensional space by cyclically permuting the coordinates. This action is
# represented in polymake by group::cyclic_group(6)->PERMUTATION_ACTION.
# To compute the convex hull of cyclic shifts of the vector //v// = [1,6,0,5,-5,0,-5] in homogeneous coordinates, type
# > $p = orbit_polytope(new Vector([1,6,0,5,-5,0,-5]), group::cyclic_group(6)->PERMUTATION_ACTION);
#
# After this assignment, the orbit polytope is still in implicit form, and the only properties that are defined reside in GROUP->COORDINATE_ACTION:
# > print $p->GROUP->COORDINATE_ACTION->properties();
# | type: PermutationAction<Int, Rational> as Polytope<Rational>::GROUP::COORDINATE_ACTION
# |
# | GENERATORS
# | 1 2 3 4 5 0
# |
# |
# | INPUT_RAYS_GENERATORS
# | 1 6 0 5 -5 0 -5
#
# To calculate the vertices of the orbit polytope explicitly, say
# > print $p->VERTICES;
# | 1 -5 0 -5 6 0 5
# | 1 -5 6 0 5 -5 0
# | 1 0 -5 6 0 5 -5
# | 1 0 5 -5 0 -5 6
# | 1 5 -5 0 -5 6 0
# | 1 6 0 5 -5 0 -5
user_function orbit_polytope(Vector, group::PermutationAction) {
my ($input_point, $a) = @_;
return orbit_polytope(vector2row($input_point), $a->GENERATORS);
}
# @category Symmetry
# Constructs the orbit polytope of a given set of points //input_points//
# with respect to a given group action //a//.
# @param Matrix input_points the basis points of the orbit polytope
# @param group::PermutationAction a the action of a permutation group on the coordinates of the ambient space
# @return Polytope the orbit polytope of //input_points// w.r.t. the action //a//
# @example To find the orbit of more than one point under a PermutationAction on the coordinates, say
# > $p = orbit_polytope(new Matrix([ [1,6,0,5,-5,0,-5], [1,1,2,3,4,5,6] ]), new group::PermutationAction(GENERATORS=>[ [1,2,3,4,5,0] ]));
# > print $p->VERTICES;
# | 1 -5 0 -5 6 0 5
# | 1 -5 6 0 5 -5 0
# | 1 0 -5 6 0 5 -5
# | 1 0 5 -5 0 -5 6
# | 1 5 -5 0 -5 6 0
# | 1 6 0 5 -5 0 -5
# | 1 1 2 3 4 5 6
# | 1 2 3 4 5 6 1
# | 1 3 4 5 6 1 2
# | 1 4 5 6 1 2 3
# | 1 5 6 1 2 3 4
# | 1 6 1 2 3 4 5
user_function orbit_polytope(Matrix, group::PermutationAction) {
my ($input_points, $a) = @_;
return orbit_polytope($input_points, $a->GENERATORS);
}
# @category Symmetry
# Constructs the orbit polytope of a given point //input_point//
# with respect to a given group action //a//.
# @param Vector input_point the basis point of the orbit polytope
# @param group::Group g a group with a PERMUTATION_ACTION that acts on the coordinates of the ambient space
# @return Polytope the orbit polytope of //input_point// w.r.t. the action of //g//
# @example As a convenience function, you can also directly specify a group::Group that contains a PERMUTATION_ACTION:
# > $p = orbit_polytope(new Vector([1,6,0,5,-5,0,-5]), group::cyclic_group(6));
#
# Up to now, the orbit polytope is still in implicit form. To calculate the vertices explicitly, say
# > print $p->VERTICES;
# | 1 -5 0 -5 6 0 5
# | 1 -5 6 0 5 -5 0
# | 1 0 -5 6 0 5 -5
# | 1 0 5 -5 0 -5 6
# | 1 5 -5 0 -5 6 0
# | 1 6 0 5 -5 0 -5
user_function orbit_polytope(Vector, group::Group) {
my ($input_point, $a) = @_;
return orbit_polytope(vector2row($input_point), $a->PERMUTATION_ACTION->GENERATORS);
}
# @category Symmetry
# Constructs the orbit polytope of a given set of points //input_points//
# with respect to a given group action //a//.
# @param Matrix input_points the basis points of the orbit polytope
# @param group::Group g a group with a PERMUTATION_ACTION that acts on the coordinates of the ambient space
# @return Polytope the orbit polytope of //input_points// w.r.t. the action of //g//
# @example As a convenience function, you can also directly specify a group::Group that contains a PERMUTATION_ACTION:
# > $p = orbit_polytope(new Matrix([ [1,6,0,5,-5,0,-5], [1,1,2,3,4,5,6] ]), group::cyclic_group(6));
# > print $p->VERTICES;
# | 1 -5 0 -5 6 0 5
# | 1 -5 6 0 5 -5 0
# | 1 0 -5 6 0 5 -5
# | 1 0 5 -5 0 -5 6
# | 1 5 -5 0 -5 6 0
# | 1 6 0 5 -5 0 -5
# | 1 1 2 3 4 5 6
# | 1 2 3 4 5 6 1
# | 1 3 4 5 6 1 2
# | 1 4 5 6 1 2 3
# | 1 5 6 1 2 3 4
# | 1 6 1 2 3 4 5
user_function orbit_polytope(Matrix, group::Group) {
my ($input_points, $a) = @_;
return orbit_polytope($input_points, $a->PERMUTATION_ACTION->GENERATORS);
}
# @category Symmetry
# Constructs the orbit polytope of a given set of points //input_points//
# with respect to a given set of generators //gens//.
# @param Matrix input_points the basis point of the orbit polytope
# @param Array<Array<Int>> gens the generators of a permutation group that acts on the coordinates of the ambient space
# @return Polytope the orbit polytope of //input_points// w.r.t. the coordinate action generated by //gens//
# @example This is a variation where several points are given as the row of a matrix, and the permutation action
# on coordinates is given by explicitly listing the generators. In this example, the matrix has just one row,
# and there is just one generator.
# > print orbit_polytope(new Matrix([ [1,6,0,5,-5,0,-5] ]), [ [1,2,3,4,5,0] ])->VERTICES;
# | 1 -5 0 -5 6 0 5
# | 1 -5 6 0 5 -5 0
# | 1 0 -5 6 0 5 -5
# | 1 0 5 -5 0 -5 6
# | 1 5 -5 0 -5 6 0
# | 1 6 0 5 -5 0 -5
user_function orbit_polytope(Matrix, can_convert_to<Array<Array<Int>>>) {
my ($input_points, $gens) = @_;
my $a = new group::PermutationAction(GENERATORS=>$gens, INPUT_RAYS_GENERATORS=>$input_points);
my $g = new group::Group;
my $p = new Polytope;
$p->add("GROUP", $g, COORDINATE_ACTION=>$a);
return $p;
}
# @category Symmetry
# Constructs the orbit polytope of a given point //input_point//
# with respect to a given matrix group action //a//.
# @param Vector input_point the generating point of the orbit polytope
# @param group::MatrixActionOnVectors a the action of a matrix group on the coordinates of the ambient space
# @tparam Scalar S the underlying number type
# @return Polytope the orbit polytope of //input_point// w.r.t. the action //a//
# @example polymake also supports orbit polytopes under the action of a group by matrices.
# To find the orbit of a point in the plane under the symmetry group of the square, say
# > $p = orbit_polytope(new Vector([1,2,1]), cube(2, group=>1)->GROUP->MATRIX_ACTION);
# > print $p->VERTICES;
# | 1 -2 -1
# | 1 -2 1
# | 1 -1 -2
# | 1 -1 2
# | 1 1 -2
# | 1 1 2
# | 1 2 -1
# | 1 2 1
user_function orbit_polytope<Scalar>(Vector<Scalar>, group::MatrixActionOnVectors<Scalar>) {
my ($input_point, $a) = @_;
return orbit_polytope(vector2row($input_point), $a);
}
# @category Symmetry
# Constructs the orbit polytope of a given set of points //input_points//
# with respect to a given matrix group action //a//.
# @param Matrix<Scalar> input_points the generating points of the orbit polytope
# @param group::MatrixActionOnVectors<Scalar> a the action of a matrix group on the coordinates of the ambient space
# @tparam Scalar S the underlying number type
# @return Polytope the orbit polytope of the //input_points// w.r.t. the action //a//
# @example To find the orbit of more than one point in the plane under the symmetry group of the square, say
# > $p = orbit_polytope(new Matrix([ [1,2,1], [1,5/2,0] ]), cube(2, group=>1)->GROUP->MATRIX_ACTION);
# > print $p->VERTICES;
# | 1 -2 -1
# | 1 -2 1
# | 1 -1 -2
# | 1 -1 2
# | 1 1 -2
# | 1 1 2
# | 1 2 -1
# | 1 2 1
# | 1 -5/2 0
# | 1 0 -5/2
# | 1 0 5/2
# | 1 5/2 0
user_function orbit_polytope<Scalar>(Matrix<Scalar>, group::MatrixActionOnVectors<Scalar>) {
my ($input_points, $a) = @_;
my $aind = new group::MatrixActionOnVectors<Scalar>(GENERATORS=>$a->GENERATORS, INPUT_RAYS_GENERATORS=>$input_points);
my $g = new group::Group;
my $p = new Polytope<Scalar>;
$p->add("GROUP", $g, MATRIX_ACTION=>$aind);
return $p;
}
# @category Symmetry
# Given a polytope that has a matrix group acting on it, return the projections of the vertices to the //i//-th isotypic component //C_i//.
# If the input is a group with a permutation action //a//, regard //a// as acting on the unit basis vectors of the ambient space
# and return the projection of the unit basis vectors to the //i//-th isotypic component.
# @param Polytope P a polytope with a matrix action, or a group::Group g with a permutation action
# @param Int i the index of the desired isotypic component
# @return polytope::PointConfiguration<Float>
# @example [notest] Consider the symmetry group of the cyclic polytope c(4,10) in the Carathéodory realization.
# > $p = cyclic_caratheodory(4,10,group=>1);
# For i=4, we obtain a 10-gon:
# > print isotypic_configuration($p,4)->POINTS;
# | 1 1 0
# | 1 0.8090169944 0.5877852523
# | 1 0.3090169944 0.9510565163
# | 1 -0.3090169944 0.9510565163
# | 1 -0.8090169944 0.5877852523
# | 1 -1 0
# | 1 -0.8090169944 -0.5877852523
# | 1 -0.3090169944 -0.9510565163
# | 1 0.3090169944 -0.9510565163
# | 1 0.8090169944 -0.5877852523
# Similarly, for i=5 we get two copies of a pentagon.
user_function isotypic_configuration($$) {
my ($p, $i) = @_;
my $projector;
if ($p->isa("Polytope") ||
$p->isa("PointConfiguration")) {
$projector = group::isotypic_projector($p->GROUP, $p->GROUP->MATRIX_ACTION, $i, permute_to_orbit_order=>0);
} else {
$projector = group::isotypic_projector($g, $g->PERMUTATION_ACTION, $i, permute_to_orbit_order=>0);
}
my $basis = orthonormal_row_basis($projector);
my $projection = new Matrix<Float>($p->VERTICES * $projector);
my $v = solve_left($basis, $projection);
my $o = ones_vector<Float>($v->rows());
return new PointConfiguration<Float>(POINTS=>($o|$v));
}
# Local Variables:
# mode: perl
# cperl-indent-level: 3
# indent-tabs-mode:nil
# End:
|