@@ -18,7 +18,7 @@ AUTHORS:
18
18
#
19
19
# Distributed under the terms of the GNU General Public License (GPL)
20
20
#
21
- # http ://www.gnu.org/licenses/
21
+ # https ://www.gnu.org/licenses/
22
22
# #######################################################################
23
23
24
24
from sage.misc.fast_methods cimport hash_by_id
@@ -76,7 +76,6 @@ cdef class Point(SageObject):
76
76
cdef object _point_configuration
77
77
cdef object _reduced_affine_vector, _reduced_projective_vector
78
78
79
-
80
79
def __init__ (self , point_configuration , i , projective , affine , reduced ):
81
80
r """
82
81
Construct a :class:`Point`.
@@ -129,7 +128,6 @@ cdef class Point(SageObject):
129
128
"""
130
129
return self ._point_configuration
131
130
132
-
133
131
def __iter__ (self ):
134
132
r """
135
133
Iterate through the affine ambient space coordinates of the point.
@@ -160,7 +158,6 @@ cdef class Point(SageObject):
160
158
"""
161
159
return len (self ._affine)
162
160
163
-
164
161
cpdef index(self ):
165
162
"""
166
163
Return the index of the point in the point configuration.
@@ -175,7 +172,6 @@ cdef class Point(SageObject):
175
172
"""
176
173
return self ._index
177
174
178
-
179
175
cpdef projective(self ):
180
176
r """
181
177
Return the projective coordinates of the point in the ambient space.
@@ -202,7 +198,6 @@ cdef class Point(SageObject):
202
198
"""
203
199
return self ._projective
204
200
205
-
206
201
cpdef affine(self ):
207
202
r """
208
203
Return the affine coordinates of the point in the ambient space.
@@ -229,7 +224,6 @@ cdef class Point(SageObject):
229
224
"""
230
225
return self ._affine
231
226
232
-
233
227
cpdef reduced_affine(self ):
234
228
r """
235
229
Return the affine coordinates of the point on the hyperplane
@@ -257,7 +251,6 @@ cdef class Point(SageObject):
257
251
"""
258
252
return self ._reduced_affine
259
253
260
-
261
254
cpdef reduced_projective(self ):
262
255
r """
263
256
Return the projective coordinates of the point on the hyperplane
@@ -285,7 +278,6 @@ cdef class Point(SageObject):
285
278
"""
286
279
return tuple (self ._reduced_affine)+ (1 ,)
287
280
288
-
289
281
cpdef reduced_affine_vector(self ):
290
282
"""
291
283
Return the affine coordinates of the point on the hyperplane
@@ -313,7 +305,6 @@ cdef class Point(SageObject):
313
305
"""
314
306
return self ._reduced_affine_vector
315
307
316
-
317
308
cpdef reduced_projective_vector(self ):
318
309
"""
319
310
Return the affine coordinates of the point on the hyperplane
@@ -359,7 +350,7 @@ cdef class Point(SageObject):
359
350
sage: p._repr_()
360
351
'P(0, 0)'
361
352
"""
362
- return ' P' + str (self ._affine)
353
+ return ' P' + str (self ._affine)
363
354
364
355
365
356
# #######################################################################
@@ -398,15 +389,13 @@ cdef class PointConfiguration_base(Parent):
398
389
self ._init_points(points)
399
390
self ._is_affine = defined_affine
400
391
401
-
402
392
cdef tuple _pts
403
393
cdef int _ambient_dim
404
394
cdef int _dim
405
395
cdef object _base_ring
406
396
cdef bint _is_affine
407
397
cdef object _reduced_affine_vector_space, _reduced_projective_vector_space
408
398
409
-
410
399
cdef _init_points(self , tuple projective_points):
411
400
"""
412
401
Internal method to determine coordinates of points.
@@ -449,20 +438,20 @@ cdef class PointConfiguration_base(Parent):
449
438
else :
450
439
raise NotImplementedError # TODO
451
440
452
- if n> 1 :
441
+ if n > 1 :
453
442
# shift first point to origin
454
- red = matrix([ aff.column(i)- aff.column(0 ) for i in range (n) ]).transpose()
443
+ red = matrix([aff.column(i)- aff.column(0 ) for i in range (n)]).transpose()
455
444
# pick linearly independent rows
456
- red = matrix([ red.row(i) for i in red.pivot_rows()])
445
+ red = matrix([red.row(i) for i in red.pivot_rows()])
457
446
else :
458
- red = matrix(0 ,1 )
447
+ red = matrix(0 , 1 )
459
448
self ._dim = red.nrows()
460
449
461
450
from sage.modules.free_module import VectorSpace
462
451
self ._reduced_affine_vector_space = VectorSpace(self ._base_ring.fraction_field(), self ._dim)
463
452
self ._reduced_projective_vector_space = VectorSpace(self ._base_ring.fraction_field(), self ._dim+ 1 )
464
453
self ._pts = tuple ([Point(self , i, proj.column(i),
465
- aff.column(i), red.column(i))
454
+ aff.column(i), red.column(i))
466
455
for i in range (n)])
467
456
468
457
def __hash__ (self ):
@@ -497,7 +486,6 @@ cdef class PointConfiguration_base(Parent):
497
486
"""
498
487
return self ._reduced_affine_vector_space
499
488
500
-
501
489
cpdef reduced_projective_vector_space(self ):
502
490
"""
503
491
Return the vector space that is spanned by the homogeneous
@@ -519,7 +507,6 @@ cdef class PointConfiguration_base(Parent):
519
507
"""
520
508
return self ._reduced_projective_vector_space
521
509
522
-
523
510
cpdef ambient_dim(self ):
524
511
"""
525
512
Return the dimension of the ambient space of the point
@@ -537,11 +524,9 @@ cdef class PointConfiguration_base(Parent):
537
524
"""
538
525
return self ._ambient_dim
539
526
540
-
541
527
cpdef dim(self ):
542
528
"""
543
- Return the actual dimension of the point
544
- configuration.
529
+ Return the actual dimension of the point configuration.
545
530
546
531
See also :meth:`ambient_dim`
547
532
@@ -555,7 +540,6 @@ cdef class PointConfiguration_base(Parent):
555
540
"""
556
541
return self ._dim
557
542
558
-
559
543
cpdef base_ring(self ):
560
544
r """
561
545
Return the base ring, that is, the ring containing the
@@ -581,10 +565,9 @@ cdef class PointConfiguration_base(Parent):
581
565
"""
582
566
return self ._base_ring
583
567
584
-
585
568
cpdef bint is_affine(self ):
586
569
"""
587
- Whether the configuration is defined by affine points.
570
+ Return whether the configuration is defined by affine points.
588
571
589
572
OUTPUT:
590
573
@@ -603,7 +586,6 @@ cdef class PointConfiguration_base(Parent):
603
586
"""
604
587
return self ._is_affine
605
588
606
-
607
589
def _assert_is_affine (self ):
608
590
"""
609
591
Raise a ``ValueError`` if the point configuration is not
@@ -622,7 +604,6 @@ cdef class PointConfiguration_base(Parent):
622
604
if not self .is_affine():
623
605
raise ValueError (' The point configuration contains projective points.' )
624
606
625
-
626
607
def __getitem__ (self , i ):
627
608
"""
628
609
Return the ``i``-th point.
@@ -651,7 +632,6 @@ cdef class PointConfiguration_base(Parent):
651
632
"""
652
633
return self ._pts[i]
653
634
654
-
655
635
cpdef n_points(self ):
656
636
"""
657
637
Return the number of points.
@@ -673,14 +653,13 @@ cdef class PointConfiguration_base(Parent):
673
653
"""
674
654
return len (self ._pts)
675
655
676
-
677
656
cpdef points(self ):
678
657
"""
679
658
Return a list of the points.
680
659
681
660
OUTPUT:
682
661
683
- Returns a list of the points. See also the :meth:`__iter__`
662
+ A list of the points. See also the :meth:`__iter__`
684
663
method, which returns the corresponding generator.
685
664
686
665
EXAMPLES::
@@ -699,7 +678,6 @@ cdef class PointConfiguration_base(Parent):
699
678
"""
700
679
return self ._pts
701
680
702
-
703
681
def point (self , i ):
704
682
"""
705
683
Return the i-th point of the configuration.
@@ -753,10 +731,9 @@ cdef class PointConfiguration_base(Parent):
753
731
"""
754
732
return len (self ._pts)
755
733
756
-
757
734
cpdef simplex_to_int(self , simplex):
758
735
r """
759
- Returns an integer that uniquely identifies the given simplex.
736
+ Return an integer that uniquely identifies the given simplex.
760
737
761
738
See also the inverse method :meth:`int_to_simplex`.
762
739
@@ -790,19 +767,18 @@ cdef class PointConfiguration_base(Parent):
790
767
cdef int k = 1
791
768
cdef int n = self .n_points()
792
769
cdef int d = len (simplex)
793
- assert d== self .dim()+ 1
770
+ assert d == self .dim()+ 1
794
771
cdef int i, j
795
- for i in range (1 ,d+ 1 ):
772
+ for i in range (1 , d+ 1 ):
796
773
l = simplex[i- 1 ]+ 1
797
- for j in range (k,l):
798
- s += binomial(n- j,d- i)
774
+ for j in range (k, l):
775
+ s += binomial(n- j, d- i)
799
776
k = l+ 1
800
777
return s
801
778
802
-
803
779
cpdef int_to_simplex(self , int s):
804
780
r """
805
- Reverses the enumeration of possible simplices in
781
+ Reverse the enumeration of possible simplices in
806
782
:meth:`simplex_to_int`.
807
783
808
784
The enumeration is compatible with [PUNTOS ]_.
@@ -930,7 +906,6 @@ cdef class ConnectedTriangulationsIterator(SageObject):
930
906
931
907
cdef triangulations_ptr _tp
932
908
933
-
934
909
def __cinit__( self) :
935
910
"""
936
911
The Cython constructor.
@@ -944,7 +919,6 @@ cdef class ConnectedTriangulationsIterator(SageObject):
944
919
"""
945
920
self. _tp = NULL
946
921
947
-
948
922
def __init__( self, point_configuration, seed=None, star=None, fine=False) :
949
923
r"""
950
924
The Python constructor.
@@ -978,14 +952,12 @@ cdef class ConnectedTriangulationsIterator(SageObject):
978
952
enumerated_simplices_seed,
979
953
point_configuration. bistellar_flips( ))
980
954
981
-
982
955
def __dealloc__( self) :
983
956
r"""
984
957
The Cython destructor.
985
958
"""
986
959
delete_triangulations( self. _tp)
987
960
988
-
989
961
def __iter__( self) :
990
962
r"""
991
963
The iterator interface: Start iterating.
0 commit comments