Skip to content

Commit 34bfa9d

Browse files
author
Release Manager
committed
sagemathgh-40917: switch to n_components in schemes and keep the old "num_components" as an alias cf sagemath#40887 and sagemath#40914 ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. URL: sagemath#40917 Reported by: Frédéric Chapoton Reviewer(s): Martin Rubey
2 parents b1c0774 + 9e74756 commit 34bfa9d

File tree

5 files changed

+81
-66
lines changed

5 files changed

+81
-66
lines changed

src/sage/schemes/product_projective/morphism.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def __eq__(self, right):
285285
return False
286286
PP = self.parent().codomain()
287287

288-
n = PP.num_components()
288+
n = PP.n_components()
289289
dim = [ P.ngens() for P in PP ]
290290
dim_prefix = [0,dim[0]]
291291

@@ -332,7 +332,7 @@ def __ne__(self, right):
332332
return True
333333
PP = self.parent().codomain()
334334

335-
n = PP.num_components()
335+
n = PP.n_components()
336336
dim = [ P.ngens() for P in PP ]
337337
dim_prefix = [0,dim[0]]
338338

@@ -393,7 +393,7 @@ def is_morphism(self):
393393
f = self.change_ring(T.base_ring().fraction_field())
394394
T = T.change_ring(T.base_ring().fraction_field())
395395

396-
for i in range(S.num_components()):
396+
for i in range(S.n_components()):
397397
t = S[i].dimension_relative() + 1
398398
X = T.subscheme(list(f)[m : m + t])
399399
if X.dimension() > -1:

src/sage/schemes/product_projective/point.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def __copy__(self):
215215
sage: P == Q
216216
True
217217
"""
218-
P = [copy(self[i]) for i in range(self.codomain().ambient_space().num_components())]
218+
P = [copy(self[i]) for i in range(self.codomain().ambient_space().n_components())]
219219
return (self.codomain().point(P, False))
220220

221221
def __iter__(self):
@@ -250,7 +250,7 @@ def __len__(self):
250250
4
251251
"""
252252
image = self.codomain().ambient_space()
253-
return image.dimension() + image.num_components()
253+
return image.dimension() + image.n_components()
254254

255255
def __hash__(self):
256256
"""
@@ -308,7 +308,7 @@ def normalize_coordinates(self):
308308
sage: P
309309
(1 : 2 : 3 , 2 : 1 : 3)
310310
"""
311-
for i in range(self.codomain().ambient_space().num_components()):
311+
for i in range(self.codomain().ambient_space().n_components()):
312312
self[i].normalize_coordinates()
313313

314314
def dehomogenize(self, L):
@@ -352,7 +352,7 @@ def dehomogenize(self, L):
352352
PP = self.codomain()
353353
A = PP.affine_patch(L)
354354
pt = []
355-
for i in range(PP.ambient_space().num_components()):
355+
for i in range(PP.ambient_space().n_components()):
356356
pt.extend(self[i].dehomogenize(L[i]))
357357
return A(pt)
358358

@@ -377,9 +377,9 @@ def scale_by(self, t):
377377
"""
378378
if not isinstance(t, (tuple, list)):
379379
raise TypeError("%s must be a list or tuple" % t)
380-
if len(t) != self.codomain().ambient_space().num_components():
380+
if len(t) != self.codomain().ambient_space().n_components():
381381
raise TypeError("%s must have same number of components as %r" % (t, self))
382-
for i in range(self.codomain().ambient_space().num_components()):
382+
for i in range(self.codomain().ambient_space().n_components()):
383383
self[i].scale_by(t[i])
384384

385385
def change_ring(self, R, **kwds):
@@ -463,7 +463,7 @@ def global_height(self, prec=None):
463463
if K not in NumberFields() and K != ZZ and not isinstance(K, (sage.rings.abc.Order, sage.rings.abc.AlgebraicField)):
464464
raise TypeError("must be over a number field or a number field order or QQbar")
465465

466-
n = self.codomain().ambient_space().num_components()
466+
n = self.codomain().ambient_space().n_components()
467467
return max(self[i].global_height(prec=prec) for i in range(n))
468468

469469
def local_height(self, v, prec=None):
@@ -501,7 +501,7 @@ def local_height(self, v, prec=None):
501501
if K not in NumberFields():
502502
raise TypeError("must be over a number field or a number field order")
503503

504-
n = self.codomain().ambient_space().num_components()
504+
n = self.codomain().ambient_space().n_components()
505505
return max(self[i].local_height(v, prec=prec) for i in range(n))
506506

507507

src/sage/schemes/product_projective/rational_point.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def enum_product_projective_rational_field(X, B):
132132
raise TypeError("codomain must be product of projective space over the rational field")
133133

134134
R = X.codomain().ambient_space()
135-
m = R.num_components()
135+
m = R.n_components()
136136
iters = [R[i].points_of_bounded_height(bound=B) for i in range(m)]
137137
dim = [R[i].dimension_relative() + 1 for i in range(m)]
138138

@@ -356,7 +356,7 @@ def sieve(X, bound):
356356
N = P.ngens()
357357
dim_scheme = X.dimension()
358358

359-
num_comp = P.num_components()
359+
num_comp = P.n_components()
360360
comp_dim_relative = [P[i].dimension_relative() + 1 for i in range(num_comp)]
361361

362362
dim_prefix = [0, comp_dim_relative[0]] # prefixes dim list

0 commit comments

Comments
 (0)