Manipulating entries of Matrices
Posted: 13 Nov 2016, 12:20
How do you access or change single entries of matrices?
For example, given the following polytope, I would like to construct the convex hull of its finite vertices and the origin:
My naive approach was to check which rows of $q->VERTICES have "1" as first entry, put them into a new matrix, add [1,0,0] to that matrix and construct a new polytope out of it.
edit: nevermind, you can access matrix elements using "->[j]" or "->elem(i,j)" and you change matrix elements using the latter.
For example, given the following polytope, I would like to construct the convex hull of its finite vertices and the origin:
Code: Select all
$q = new Polytope<Rational>(POINTS=>[[0,1,0],[0,0,1],[1,0,3],[1,1,1],[1,3,0]]);
edit: nevermind, you can access matrix elements using "->[j]" or "->elem(i,j)" and you change matrix elements using the latter.