Skip to content

Commit 32f7d9e

Browse files
committed
suggested details
1 parent 302ca3e commit 32f7d9e

File tree

3 files changed

+38
-38
lines changed

3 files changed

+38
-38
lines changed

src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -732,67 +732,67 @@ cpdef find_brouwer_separable_design(int k,int n) noexcept:
732732
False
733733
"""
734734
from sage.combinat.designs.orthogonal_arrays_build_recursive import brouwer_separable_design
735-
cdef int q,x,baer_subplane_size, max_t, min_t, t,e1,e2,e3,e4
735+
cdef int q, x, baer_subplane_size, max_t, min_t, t, e1, e2, e3, e4
736736

737-
for q in prime_powers(2,n):
738-
baer_subplane_size = q**2+q+1
737+
for q in prime_powers(2, n):
738+
baer_subplane_size = q**2 + q + 1
739739
if baer_subplane_size > n:
740740
break
741741
# x <= q^2+1
742742
# <=> n-t(q^2+q+1) <= q^2+1
743743
# <=> n-q^2-1 <= t(q^2+q+1)
744744
# <=> (n-q^2-1)/(q^2+q+1) <= t
745745

746-
min_t = (n-q**2-1)/baer_subplane_size
747-
max_t = min(n/baer_subplane_size,q**2-q+1)
746+
min_t = (n - q**2 - 1) / baer_subplane_size
747+
max_t = min(n / baer_subplane_size, q**2 - q + 1)
748748

749-
for t in range(min_t,max_t+1):
750-
x = n - t*baer_subplane_size
751-
e1 = int(x != q**2-q-t)
749+
for t in range(min_t, max_t + 1):
750+
x = n - t * baer_subplane_size
751+
e1 = int(x != q**2 - q - t)
752752
e2 = int(x != 1)
753753
e3 = int(x != q**2)
754-
e4 = int(x != t+q+1)
754+
e4 = int(x != t + q + 1)
755755

756756
# i)
757757
if (x == 0 and
758-
is_available(k, t) and is_available(k, t+q)):
758+
is_available(k, t) and is_available(k, t + q)):
759759
return brouwer_separable_design, (k, t, q, x)
760760

761761
# ii)
762-
elif (x == t+q and
763-
is_available(k+e3, t) and
764-
is_available(k, t+q) and
765-
is_available(k+1 ,t+q+1)):
762+
elif (x == t + q and
763+
is_available(k + e3, t) and
764+
is_available(k, t + q) and
765+
is_available(k + 1, t + q + 1)):
766766
return brouwer_separable_design, (k, t, q, x)
767767

768768
# iii)
769-
elif (x == q**2-q+1-t and
769+
elif (x == q**2 - q + 1 - t and
770770
is_available(k, x) and
771-
is_available(k+e2, t+1)
772-
and is_available(k+1, t+q)):
771+
is_available(k + e2, t + 1)
772+
and is_available(k + 1, t + q)):
773773
return brouwer_separable_design, (k, t, q, x)
774774

775775
# iv)
776-
elif (x == q**2+1 and
776+
elif (x == q**2 + 1 and
777777
is_available(k, x) and
778-
is_available(k+e4, t+1) and
779-
is_available(k+1 ,t+q+1)):
778+
is_available(k + e4, t + 1) and
779+
is_available(k + 1, t + q + 1)):
780780
return brouwer_separable_design, (k, t, q, x)
781781

782782
# v)
783-
elif (0<x and x<q**2-q+1-t and (e1 or e2) and
783+
elif (0 < x < q**2 - q + 1 - t and (e1 or e2) and
784784
is_available(k, x) and
785-
is_available(k+e1, t) and
786-
is_available(k+e2, t+1) and
787-
is_available(k+1, t+q)):
785+
is_available(k + e1, t) and
786+
is_available(k + e2, t + 1) and
787+
is_available(k + 1, t + q)):
788788
return brouwer_separable_design, (k, t, q, x)
789789

790790
# vi)
791-
elif (t+q<x and x<q**2+1 and (e3 or e4) and
791+
elif (t + q < x < q**2 + 1 and (e3 or e4) and
792792
is_available(k, x) and
793-
is_available(k+e3, t) and
794-
is_available(k+e4, t+1) and
795-
is_available(k+1, t+q+1)):
793+
is_available(k + e3, t) and
794+
is_available(k + e4, t + 1) and
795+
is_available(k + 1, t + q + 1)):
796796
return brouwer_separable_design, (k, t, q, x)
797797

798798
return False

src/sage/matrix/matrix0.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ cdef class Matrix(sage.structure.element.Matrix):
386386
of this matrix. If i, j are out of range, an IndexError is
387387
raised.
388388
"""
389-
if i<0 or i >= self._nrows or j<0 or j >= self._ncols:
389+
if i < 0 or i >= self._nrows or j<0 or j >= self._ncols:
390390
raise IndexError("matrix index out of range")
391391

392392
cdef check_mutability(self) noexcept:
@@ -419,7 +419,7 @@ cdef class Matrix(sage.structure.element.Matrix):
419419
else:
420420
self._cache = None
421421

422-
if i<0 or i >= self._nrows or j<0 or j >= self._ncols:
422+
if i < 0 or i >= self._nrows or j < 0 or j >= self._ncols:
423423
raise IndexError("matrix index out of range")
424424

425425
def set_immutable(self):
@@ -3706,7 +3706,7 @@ cdef class Matrix(sage.structure.element.Matrix):
37063706
if positive and not d[i] > 0:
37073707
return False
37083708
for j in d:
3709-
if d[i] * self.get_unsafe(i, j) != sign * d[j] * self.get_unsafe(j,i):
3709+
if d[i] * self.get_unsafe(i, j) != sign * d[j] * self.get_unsafe(j, i):
37103710
return False
37113711
return L
37123712

@@ -4297,7 +4297,7 @@ cdef class Matrix(sage.structure.element.Matrix):
42974297

42984298
for i from 0 <= i < self._nrows:
42994299
for j from 0 <= j <= i:
4300-
if self.get_unsafe(i, j) != -self.get_unsafe(j,i):
4300+
if self.get_unsafe(i, j) != -self.get_unsafe(j, i):
43014301
return False
43024302
return True
43034303

@@ -4843,10 +4843,10 @@ cdef class Matrix(sage.structure.element.Matrix):
48434843
cdef Py_ssize_t j
48444844
tmp = []
48454845

4846-
if i<0 or i >= self._ncols:
4846+
if i < 0 or i >= self._ncols:
48474847
raise IndexError("matrix column index out of range")
48484848
for j from 0 <= j < self._nrows:
4849-
if not self.get_is_zero_unsafe(j,i):
4849+
if not self.get_is_zero_unsafe(j, i):
48504850
tmp.append(j)
48514851
return tmp
48524852

src/sage/stats/hmm/distributions.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ cdef class GaussianMixtureDistribution(Distribution):
182182
sage: hmm.GaussianMixtureDistribution([(1,-1,0)], eps=1e-3)
183183
1.0*N(-1.0,0.001)
184184
"""
185-
B = [[c if c >= 0 else 0, mu, std if std > 0 else eps]
185+
B = [[(c if c >= 0 else 0), mu, (std if std > 0 else eps)]
186186
for c, mu, std in B]
187187
if not B:
188188
raise ValueError("must specify at least one component of the mixture model")
@@ -197,9 +197,9 @@ cdef class GaussianMixtureDistribution(Distribution):
197197
else:
198198
for a in B:
199199
a[0] /= s
200-
self.c0 = TimeSeries([c/(sqrt2pi*std) for c,_,std in B])
201-
self.c1 = TimeSeries([-1.0/(2*std*std) for _,_,std in B])
202-
self.param = TimeSeries(sum([list(x) for x in B],[]))
200+
self.c0 = TimeSeries([c/(sqrt2pi*std) for c, _, std in B])
201+
self.c1 = TimeSeries([-1.0/(2*std*std) for _, _, std in B])
202+
self.param = TimeSeries(sum([list(x) for x in B], []))
203203
self.fixed = IntList(self.c0._length)
204204

205205
def __getitem__(self, Py_ssize_t i):

0 commit comments

Comments
 (0)