Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/simplification of doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Apr 24, 2020
1 parent 41eb697 commit 56dcddf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,9 @@ def incidence_matrix_to_bit_rep_of_facets(matrix):
....: from sage.ext.memory_allocator cimport MemoryAllocator
....: from libc.stdint cimport uint64_t
....:
....: def bit_rep_to_Vrep_list_wrapper(list_of_faces, index):
....: def bit_rep_to_Vrep_list_wrapper(ListOfFaces faces, index):
....: cdef MemoryAllocator mem = MemoryAllocator()
....: cdef size_t *output
....: cdef ListOfFaces faces = list_of_faces
....: output = <size_t *> mem.allocarray(faces.n_atoms,
....: sizeof(size_t))
....: cdef uint64_t * data = faces.data[index]
Expand Down Expand Up @@ -343,10 +342,9 @@ def incidence_matrix_to_bit_rep_of_Vrep(matrix):
....: from sage.ext.memory_allocator cimport MemoryAllocator
....: from libc.stdint cimport uint64_t
....:
....: def bit_rep_to_Vrep_list_wrapper(list_of_faces, index):
....: def bit_rep_to_Vrep_list_wrapper(ListOfFaces faces, index):
....: cdef MemoryAllocator mem = MemoryAllocator()
....: cdef size_t *output
....: cdef ListOfFaces faces = list_of_faces
....: output = <size_t *> mem.allocarray(faces.n_atoms,
....: sizeof(size_t))
....: cdef uint64_t * data = faces.data[index]
Expand Down Expand Up @@ -439,10 +437,9 @@ def facets_tuple_to_bit_rep_of_facets(tuple facets_input, size_t n_Vrep):
....: from sage.ext.memory_allocator cimport MemoryAllocator
....: from libc.stdint cimport uint64_t
....:
....: def bit_rep_to_Vrep_list_wrapper(list_of_faces, index):
....: def bit_rep_to_Vrep_list_wrapper(ListOfFaces faces, index):
....: cdef MemoryAllocator mem = MemoryAllocator()
....: cdef size_t *output
....: cdef ListOfFaces faces = list_of_faces
....: output = <size_t *> mem.allocarray(faces.n_atoms,
....: sizeof(size_t))
....: cdef uint64_t * data = faces.data[index]
Expand Down Expand Up @@ -506,10 +503,9 @@ def facets_tuple_to_bit_rep_of_Vrep(tuple facets_input, size_t n_Vrep):
....: from sage.ext.memory_allocator cimport MemoryAllocator
....: from libc.stdint cimport uint64_t
....:
....: def bit_rep_to_Vrep_list_wrapper(list_of_faces, index):
....: def bit_rep_to_Vrep_list_wrapper(ListOfFaces faces, index):
....: cdef MemoryAllocator mem = MemoryAllocator()
....: cdef size_t *output
....: cdef ListOfFaces faces = list_of_faces
....: output = <size_t *> mem.allocarray(faces.n_atoms,
....: sizeof(size_t))
....: cdef uint64_t * data = faces.data[index]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,12 @@ cdef class PolyhedronFaceLattice:
....: from sage.geometry.polyhedron.combinatorial_polyhedron.base \
....: cimport CombinatorialPolyhedron, FaceIterator, PolyhedronFaceLattice
....:
....: def find_face_from_iterator(it, C1):
....: cdef FaceIterator face_iter = it
....: cdef CombinatorialPolyhedron C = C1
....: def find_face_from_iterator(FaceIterator it, CombinatorialPolyhedron C):
....: C._record_all_faces()
....: cdef PolyhedronFaceLattice all_faces = C._all_faces
....: if not (all_faces.dual == it.dual):
....: raise ValueError("iterator and allfaces not in same mode")
....: return all_faces.find_face(face_iter.structure.current_dimension, face_iter.structure.face)
....: return all_faces.find_face(it.structure.current_dimension, it.structure.face)
....: ''')
sage: P = polytopes.permutahedron(4)
sage: C = CombinatorialPolyhedron(P)
Expand Down Expand Up @@ -422,15 +420,13 @@ cdef class PolyhedronFaceLattice:
....: from sage.geometry.polyhedron.combinatorial_polyhedron.base \
....: cimport CombinatorialPolyhedron, FaceIterator, PolyhedronFaceLattice
....:
....: def face_via_all_faces_from_iterator(it, C1):
....: cdef FaceIterator face_iter = it
....: cdef CombinatorialPolyhedron C = C1
....: cdef int dimension = face_iter.structure.current_dimension
....: def face_via_all_faces_from_iterator(FaceIterator it, CombinatorialPolyhedron C):
....: cdef int dimension = it.structure.current_dimension
....: C._record_all_faces()
....: cdef PolyhedronFaceLattice all_faces = C._all_faces
....: if not (all_faces.dual == it.dual):
....: raise ValueError("iterator and allfaces not in same mode")
....: index = all_faces.find_face(dimension, face_iter.structure.face)
....: index = all_faces.find_face(dimension, it.structure.face)
....: return all_faces.get_face(dimension, index)
....: ''')
sage: P = polytopes.permutahedron(4)
Expand Down

0 comments on commit 56dcddf

Please sign in to comment.