Skip to content

Commit

Permalink
sagemathgh-36595: Replace relative imports by absolute ones in `sage.…
Browse files Browse the repository at this point in the history
…{coding,combinat,graphs}`

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
- Cherry-picked from sagemath#35095
- This is for sagemath#36228
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36595
Reported by: Matthias Köppe
Reviewer(s): David Coudert
  • Loading branch information
Release Manager committed Nov 2, 2023
2 parents c1a6773 + d486801 commit d67fba1
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/sage/coding/ag_code_decoders.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ from sage.rings.function_field.constructor import FunctionField
from sage.modules.free_module_element import vector
from sage.matrix.constructor import matrix

from .encoder import Encoder
from .decoder import Decoder, DecodingError
from sage.coding.encoder import Encoder
from sage.coding.decoder import Decoder, DecodingError

from sage.modules.free_module_element cimport FreeModuleElement
from sage.matrix.matrix cimport Matrix
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/designs/designs_pyx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ def is_quasi_difference_matrix(M,G,int k,int lmbda,int mu,int u,verbose=False):
Column 1 contains 2 empty entries instead of the expected lambda.u=1.1=1
False
"""
from .difference_family import group_law
from sage.combinat.designs.difference_family import group_law

assert k>=2
assert lmbda >=1
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/designs/evenly_distributed_sets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ cdef class EvenlyDistributedSetsBacktracker:
xe = self.K.multiplicative_generator() ** (self.e)
df = [[xe**j*b for b in B] for j in range((self.q-1)/(2*self.e))]
if check:
from .difference_family import is_difference_family
from sage.combinat.designs.difference_family import is_difference_family
if not is_difference_family(self.K, df, self.q, self.k, 1):
raise RuntimeError("a wrong evenly distributed set was "
"produced by the Sage library for the parameters:\n"
Expand Down
30 changes: 15 additions & 15 deletions src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Functions
"""

from sage.misc.cachefunc import cached_function
from .orthogonal_arrays import orthogonal_array
from sage.combinat.designs.orthogonal_arrays import orthogonal_array
from sage.rings.integer cimport smallInteger
from sage.arith.misc import prime_powers

Expand Down Expand Up @@ -153,7 +153,7 @@ cpdef find_product_decomposition(int k,int n) noexcept:
# faster to use that rather than calling the divisors function
continue
if is_available(k, n1) and is_available(k, n2):
from .orthogonal_arrays import wilson_construction
from sage.combinat.designs.orthogonal_arrays import wilson_construction
return wilson_construction, (None,k,n1,n2,(),False)
return False

Expand Down Expand Up @@ -203,7 +203,7 @@ cpdef find_wilson_decomposition_with_one_truncated_group(int k,int n) noexcept:
is_available(k ,m+1) and
is_available(k+1,r ) and
is_available(k ,u )):
from .orthogonal_arrays import wilson_construction
from sage.combinat.designs.orthogonal_arrays import wilson_construction
return wilson_construction, (None,k,r,m,(u,),False)

return False
Expand Down Expand Up @@ -266,7 +266,7 @@ cpdef find_wilson_decomposition_with_two_truncated_groups(int k,int n) noexcept:
r2 = r1_p_r2-r1
if is_available(k,r2):
assert n == r*m+r1+r2
from .orthogonal_arrays import wilson_construction
from sage.combinat.designs.orthogonal_arrays import wilson_construction
return wilson_construction, (None,k,r,m,(r1,r2),False)
return False

Expand Down Expand Up @@ -306,7 +306,7 @@ cpdef find_construction_3_3(int k,int n) noexcept:

if (is_available(k+i, nn ) and
is_available(k , mm+i)):
from .orthogonal_arrays_build_recursive import construction_3_3
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_3
return construction_3_3, (k,nn,mm,i)

cpdef find_construction_3_4(int k,int n) noexcept:
Expand Down Expand Up @@ -349,7 +349,7 @@ cpdef find_construction_3_4(int k,int n) noexcept:
if (is_available(k+r+1,nn) and
is_available(k , s) and
(is_available(k,mm+r) or is_available(k,mm+r+1))):
from .orthogonal_arrays_build_recursive import construction_3_4
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_4
return construction_3_4, (k,nn,mm,r,s)

cpdef find_construction_3_5(int k,int n) noexcept:
Expand Down Expand Up @@ -399,7 +399,7 @@ cpdef find_construction_3_5(int k,int n) noexcept:
(r==0 or is_available(k,r)) and
(s==0 or is_available(k,s)) and
(t==0 or is_available(k,t))):
from .orthogonal_arrays_build_recursive import construction_3_5
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_5
return construction_3_5, (k,nn,mm,r,s,t)

cpdef find_construction_3_6(int k,int n) noexcept:
Expand Down Expand Up @@ -440,7 +440,7 @@ cpdef find_construction_3_6(int k,int n) noexcept:

if (is_available(k+i,nn) and
smallInteger(nn).is_prime_power()):
from .orthogonal_arrays_build_recursive import construction_3_6
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_6
return construction_3_6, (k,nn,mm,i)

cpdef find_q_x(int k,int n) noexcept:
Expand Down Expand Up @@ -492,7 +492,7 @@ cpdef find_q_x(int k,int n) noexcept:
# is_available(k+1,q) and
is_available(k, x+2 ) and
smallInteger(q).is_prime_power()):
from .orthogonal_arrays_build_recursive import construction_q_x
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_q_x
return construction_q_x, (k,q,x)
return False

Expand Down Expand Up @@ -546,7 +546,7 @@ cpdef find_thwart_lemma_3_5(int k,int N) noexcept:
sage: for k,n in kn: # not tested -- too long
....: assert designs.orthogonal_array(k,n,existence=True) is True
"""
from .orthogonal_arrays_build_recursive import thwart_lemma_3_5
from sage.combinat.designs.orthogonal_arrays_build_recursive import thwart_lemma_3_5
cdef int n,m,a,b,c,d,NN,na,nb,nc

for n in prime_powers(k+2,N-2): # There must exist a OA(k+3,n) thus n>=k+2
Expand Down Expand Up @@ -661,7 +661,7 @@ cpdef find_thwart_lemma_4_1(int k,int n) noexcept:
not is_available(k,mm+4)):
continue

from .orthogonal_arrays_build_recursive import thwart_lemma_4_1
from sage.combinat.designs.orthogonal_arrays_build_recursive import thwart_lemma_4_1
return thwart_lemma_4_1,(k,nn,mm)

return False
Expand Down Expand Up @@ -706,7 +706,7 @@ cpdef find_three_factor_product(int k,int n) noexcept:
not is_available(k,n2) or
not is_available(k,n3)):
continue
from .orthogonal_arrays_build_recursive import three_factor_product
from sage.combinat.designs.orthogonal_arrays_build_recursive import three_factor_product
return three_factor_product,(k-1,n1,n2,n3)

return False
Expand All @@ -731,7 +731,7 @@ cpdef find_brouwer_separable_design(int k,int n) noexcept:
sage: find_brouwer_separable_design(5,14)
False
"""
from .orthogonal_arrays_build_recursive import brouwer_separable_design
from sage.combinat.designs.orthogonal_arrays_build_recursive import brouwer_separable_design
cdef int q,x,baer_subplane_size, max_t, min_t, t,e1,e2,e3,e4

for q in prime_powers(2,n):
Expand Down Expand Up @@ -945,13 +945,13 @@ cpdef find_brouwer_van_rees_with_one_truncated_column(int k,int n) noexcept:

values = int_as_sum(remainder, available_multipliers, r)
if values is not None:
from .orthogonal_arrays import wilson_construction
from sage.combinat.designs.orthogonal_arrays import wilson_construction
return (wilson_construction,
(None,k,r,m,[[(x,1) for x in values]]))

return False

from .designs_pyx cimport _OA_cache, _OA_cache_size
from sage.combinat.designs.designs_pyx cimport _OA_cache, _OA_cache_size
cdef int is_available(int k,int n) except -1:
r"""
Return whether Sage can build an OA(k,n)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/graphs/base/c_graph.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#**************************************************************************

from sage.data_structures.bitset cimport bitset_t
from .graph_backends cimport GenericGraphBackend
from sage.graphs.base.graph_backends cimport GenericGraphBackend
from libc.stdint cimport uint32_t

cdef class CGraph:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/graphs/base/dense_graph.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# http://www.gnu.org/licenses/
#*****************************************************************************

from .c_graph cimport CGraph, CGraphBackend
from sage.graphs.base.c_graph cimport CGraph, CGraphBackend
from sage.data_structures.binary_matrix cimport binary_matrix_t

cdef class DenseGraph(CGraph):
Expand Down
8 changes: 4 additions & 4 deletions src/sage/graphs/base/graph_backends.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Classes and methods
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************
from .c_graph cimport CGraphBackend
from sage.graphs.base.c_graph cimport CGraphBackend


cdef class GenericGraphBackend(SageObject):
Expand Down Expand Up @@ -722,9 +722,9 @@ cdef class GenericGraphBackend(SageObject):
sage: loads(dumps(gi)) == gi
True
"""
from .static_sparse_backend import StaticSparseBackend
from .sparse_graph import SparseGraphBackend
from .dense_graph import DenseGraphBackend
from sage.graphs.base.static_sparse_backend import StaticSparseBackend
from sage.graphs.base.sparse_graph import SparseGraphBackend
from sage.graphs.base.dense_graph import DenseGraphBackend

# implementation, data_structure, multiedges, directed, loops
if isinstance(self, CGraphBackend):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/graphs/base/sparse_graph.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from .c_graph cimport CGraph, CGraphBackend
from sage.graphs.base.c_graph cimport CGraph, CGraphBackend
cimport cython

cdef struct SparseGraphLLNode:
Expand Down
7 changes: 5 additions & 2 deletions src/sage/graphs/base/static_sparse_backend.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from .c_graph cimport CGraph, CGraphBackend
from .static_sparse_graph cimport short_digraph, ushort
from libc.stdint cimport uint64_t, uint32_t, INT32_MAX, UINT32_MAX

from sage.data_structures.bitset cimport *
from sage.graphs.base.c_graph cimport CGraph, CGraphBackend
from sage.graphs.base.static_sparse_graph cimport short_digraph, ushort


cdef class StaticSparseCGraph(CGraph):
cdef short_digraph g
Expand All @@ -12,6 +14,7 @@ cdef class StaticSparseCGraph(CGraph):
cpdef int out_degree(self, int u) except -1
cpdef int in_degree(self, int u) except -1


cdef class StaticSparseBackend(CGraphBackend):
cdef int _order
cdef bint _multiedges
Expand Down
2 changes: 1 addition & 1 deletion src/sage/graphs/base/static_sparse_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ from sage.graphs.base.static_sparse_graph cimport (init_short_digraph,
has_edge,
free_short_digraph,
edge_label)
from .c_graph cimport CGraphBackend
from sage.graphs.base.c_graph cimport CGraphBackend
from sage.data_structures.bitset cimport FrozenBitset
from libc.stdint cimport uint32_t
from sage.data_structures.bitset_base cimport *
Expand Down
4 changes: 2 additions & 2 deletions src/sage/graphs/base/static_sparse_graph.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ from memory_allocator cimport MemoryAllocator

from sage.data_structures.bitset_base cimport *
from sage.graphs.base.c_graph cimport CGraph
from .static_sparse_backend cimport StaticSparseCGraph
from .static_sparse_backend cimport StaticSparseBackend
from sage.graphs.base.static_sparse_backend cimport StaticSparseCGraph
from sage.graphs.base.static_sparse_backend cimport StaticSparseBackend


cdef extern from "fenv.h":
Expand Down

0 comments on commit d67fba1

Please sign in to comment.