for example
Code: Select all
$a=new Set<Int>(0,1,2,3);
print $a->[2];
Why does it occur and how to avoid it? Thanks.ERROR: No random access
Code: Select all
$a=new Set<Int>(0,1,2,3);
print $a->[2];
Why does it occur and how to avoid it? Thanks.ERROR: No random access
Code: Select all
polytope > $a=new Set<Int>(0,1,2,3);
polytope > $b=new Vector<Int>($a);
polytope > print $a->[2];
polymake: ERROR: No random access
polytope > print $b->[2];
2
Code: Select all
polytope > print $a->front();
0
polytope > print $a->back();
3
By the way, another function in the documentation cannot be used.all_subsets_of_k(Any c, Int k)
Returns all subsets of size k of a given container as perl-array.
Parameters:
Any c: any container type, e.g. Set or Array
Int k: size of the subsets
Returns:
Array<Array<Any>>
all_subsets(Any c)
Returns all subsets of size k of a given container as perl-array.
Parameters:
Any c: any container type, e.g. Set or Array
Returns:
Array<Array<Any>>
Code: Select all
$a=new Array<Set<Int>>();
Code: Select all
push(@a, $b);
Code: Select all
int a[3];
for(int i=0;i<=2;i++){ a[I]=i; }
Code: Select all
$a=new Array<Int>(0,1,2);
Code: Select all
@a=(1,2,3);
push @a, 10, 20, 30;
@b=@a[$i1..$i2];
for my $e (@a) { print $e,"\n"; }
Code: Select all
$s=new Set<Int>(10, 15, 20, 25);
$a=all_subsets_of_k($s,2);
for my $t (@$a) { print $t, "\n"; }
@copy=@$a;