Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ cdef get_reduced_pentagons(factory, tuple mp_params):
# Pre-compute common parameters for speed
cdef tuple basis = tuple(factory._FR.basis())
# Handle both cyclotomic and orthogonal solution method
cdef bint must_zip_up
cdef bint must_zip_up = False
for k, v in factory._fvars.items():
must_zip_up = isinstance(v, tuple)
break
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/letterplace/free_algebra_letterplace.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ cdef class FreeAlgebra_letterplace(Parent):
"""
if not D:
return self.zero()
cdef Py_ssize_t l
cdef Py_ssize_t l = 0
for e in D:
l = len(e)
break
Expand Down
2 changes: 2 additions & 0 deletions src/sage/calculus/transforms/dwt.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ cdef class DiscreteWaveletTransform(GSLDoubleArray):
from sage.plot.point import point

cdef int i
cdef int x_min = 0
cdef int x_max = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is something wrong in this method. if xmax is None, then x_max is set to self.n. Otherwise, it will remain to the default value you assigned, that is 0.
Why not doing like:

if xmin is None:
    xmin = 0
if xmax is None:
    xmax = self.n
for i in range(xmin, xmax):
...

cdef double x
v = []
if xmin is None:
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/crystals/pbw_datum.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ cpdef list enhance_braid_move_chain(braid_move_chain, cartan_type):
sage: enhanced_chain[7]
((3, 6), (-1, -1))
"""
cdef int i, j
cdef int k, pos, first, last
cdef int i = 0, j = 0
cdef int k = 0, pos, first = 0, last = 0
cdef tuple cartan_sub_matrix
cdef list output_list = []
output_list.append( (None, None) )
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/enumeration_mod_permgroup.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cpdef int lex_cmp_partial(ClonableIntArray v1, ClonableIntArray v2, int step) no
sage: lex_cmp_partial(IA([0,1,2,3]),IA([0,1,2,4]),4)
-1
"""
cdef int i
cdef int i = 0
if step < 0 or step > v1._len or step > v2._len:
raise IndexError("list index out of range")

Expand Down Expand Up @@ -271,7 +271,7 @@ cpdef set orbit(list sgs, ClonableIntArray v):
sage: sorted(orbit(sgs, IA([1,2,3,4])))
[[1, 2, 3, 4], [2, 3, 4, 1], [3, 4, 1, 2], [4, 1, 2, 3]]
"""
cdef i,l
cdef i = 0, l = 0
cdef set to_analyse, new_to_analyse
cdef ClonableIntArray list_test, child
cdef PermutationGroupElement x
Expand Down
2 changes: 2 additions & 0 deletions src/sage/combinat/matrices/dancing_links_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ class dancing_links {
current_node = NULL;
best_col = NULL;
search_started = false;
root = NULL;
mode = SEARCH_FORWARD;
}

~dancing_links()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ cpdef _normalize_coordinates(list point, int prime, int len_points):
sage: L
[1, 2, 1]
"""
cdef int last_coefficient, coefficient, mod_inverse, val
cdef int last_coefficient = 0, coefficient, mod_inverse, val

for coefficient in range(len_points):
val = ((<int> point[coefficient]) + prime) % prime
Expand Down
2 changes: 1 addition & 1 deletion src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ cpdef fast_mandelbrot_plot(double x_center, double y_center,

cdef:
M, pixel, color_list
long i, j, col, row, level, iteration
long i, j, col, row, level, iteration = 0
double x_corner, y_corner, step_size, x_coor, y_coor, new_x, new_y

# Make sure image_width is positive
Expand Down
4 changes: 2 additions & 2 deletions src/sage/geometry/triangulation/data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ vertices vertices_lookup::manual_vertices_to_simplex(const simplex & S) const
vertices result;
simplex s=S;
simplex b;
vertex i,j,l=0,k;
vertex j,l=0,k;
for (k=1; k<d; k++) {
l++; i=l; j=1;
l++; j=1;
b=binomial(n-l,d-k);
while (s>b && b>0) {
j++; l++;
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/triangulation/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class vertices: public std::set<vertex,std::less<vertex> >
void set_dimensions(int N, int D);
friend std::ostream & operator << (std::ostream &, const vertices &);
friend bool operator==(const vertices &, const vertices &);
bool full_set() const { return this->size() == n; }
bool full_set() const { return this->size() == static_cast<size_t>(n); }
};

// tables used by vertices to make computation faster
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/triangulation/triangulations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void triangulations::add_neighbours(const simplices & s)

bool triangulations::have_more_triangulations()
{
while (position != this->size()) {
while (position != static_cast<int>(this->size())) {
// eat all non-star triangulations
simplices triangulation((*this)[position]);

Expand Down
4 changes: 2 additions & 2 deletions src/sage/graphs/base/boost_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class BoostGraph

to_return.distances = distances;

for (int i = 0; i < N; i++) {
for (v_index i = 0; i < N; i++) {
to_return.predecessors.push_back(index[predecessors[i]]);
}

Expand All @@ -274,7 +274,7 @@ class BoostGraph
}

to_return.distances = distance;
for (int i = 0; i < N; i++) {
for (v_index i = 0; i < N; i++) {
to_return.predecessors.push_back(index[predecessors[i]]);
}
return to_return;
Expand Down
6 changes: 3 additions & 3 deletions src/sage/graphs/base/c_graph.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3156,7 +3156,7 @@ cdef class CGraphBackend(GenericGraphBackend):
cdef FrozenBitset b_vertices
cdef int n_vertices = len(vertices)
cdef bint loops = other.loops()
cdef bint multiple_edges
cdef bint multiple_edges = False
if modus == 0:
multiple_edges = self.multiple_edges(None) and other.multiple_edges(None)
elif 1 <= modus <= 2:
Expand Down Expand Up @@ -3893,7 +3893,7 @@ cdef class CGraphBackend(GenericGraphBackend):
# which defines the shortest path found
# (of length shortest_path_length).
cdef int meeting_vertex = -1
cdef double shortest_path_length
cdef double shortest_path_length = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this cannot be initialized to 0. IT should be +oo

cdef double f_tmp

if reduced_weight is not None:
Expand Down Expand Up @@ -4107,7 +4107,7 @@ cdef class CGraphBackend(GenericGraphBackend):
# which defines the shortest path found
# (of length shortest_path_length).
cdef int meeting_vertex = -1
cdef double shortest_path_length
cdef double shortest_path_length = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be initialized to large value +oo

cdef double f_tmp

if weight_function is None:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/graphs/comparability.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ def is_transitive(g, certificate=False):
cdef bitset_t seen
bitset_init(seen, n)

cdef uint32_t u, v
cdef uint32_t u, v = 0
cdef int i

for u in range(n):
Expand Down
4 changes: 2 additions & 2 deletions src/sage/graphs/distances_all_pairs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ cdef uint32_t * c_eccentricity_DHV(short_digraph sd) except NULL:
cdef uint32_t u, ecc_u
cdef uint32_t antipode, ecc_antipode
cdef uint32_t v, tmp
cdef size_t i, idx
cdef size_t i, idx = 0
cdef bitset_t seen
bitset_init(seen, n)

Expand Down Expand Up @@ -1592,7 +1592,7 @@ cdef uint32_t diameter_DHV(short_digraph g) noexcept:
cdef uint32_t LB = 0
cdef uint32_t UB = UINT32_MAX
cdef uint32_t v, tmp
cdef size_t i, idx
cdef size_t i, idx = 0
cdef bitset_t seen
bitset_init(seen, n)

Expand Down
2 changes: 1 addition & 1 deletion src/sage/graphs/graph_decompositions/bandwidth.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def bandwidth(G, k=None):
cdef range_t ** ith_range_array = <range_t **> mem.allocarray(n, sizeof(range_t *))
cdef range_t * range_array_tmp = <range_t *> mem.allocarray(n, sizeof(range_t))

cdef int i, kk
cdef int i, kk = 0
# compute the distance matrix
all_pairs_shortest_path_BFS(G, NULL, distances, NULL, vertex_list=int_to_vertex)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,15 @@ cdef aut_gp_and_can_lab *get_aut_gp_and_can_lab(void *S,
"""
cdef PartitionStack *current_ps
cdef PartitionStack *first_ps
cdef PartitionStack *label_ps
cdef PartitionStack *label_ps = NULL
cdef int first_meets_current = -1
cdef int label_meets_current
cdef int label_meets_current = 0
cdef int current_kids_are_same = 1
cdef int first_kids_are_same

cdef int *current_indicators
cdef int *first_indicators
cdef int *label_indicators
cdef int *label_indicators = NULL
cdef int first_and_current_indicator_same
cdef int label_and_current_indicator_same = -1
cdef int compared_current_and_label_indicators
Expand All @@ -467,7 +467,7 @@ cdef aut_gp_and_can_lab *get_aut_gp_and_can_lab(void *S,
cdef OrbitPartition *orbits_of_permutation
cdef OrbitPartition *orbits_of_supergroup
cdef int subgroup_primary_orbit_size = 0
cdef int minimal_in_primary_orbit
cdef int minimal_in_primary_orbit = 0

cdef bitset_t *fixed_points_of_generators # i.e. fp
cdef bitset_t *minimal_cell_reps_of_generators # i.e. mcr
Expand All @@ -482,7 +482,7 @@ cdef aut_gp_and_can_lab *get_aut_gp_and_can_lab(void *S,
cdef int *vertices_determining_current_stack
cdef int *perm_stack
cdef StabilizerChain *group = NULL
cdef StabilizerChain *old_group
cdef StabilizerChain *old_group = NULL
cdef StabilizerChain *tmp_gp

cdef int i, j, k, ell, b
Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/perm_gps/partn_ref/data_structures.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ cdef int compute_relabeling(StabilizerChain *group, StabilizerChain *scratch_gro
"""
Technically, compute the INVERSE of the relabeling
"""
cdef int i, j, x, y, m, n = group.degree, orbit_element
cdef int i, j, x, y = 0, m, n = group.degree, orbit_element
cdef int *scratch = group.perm_scratch
if SC_new_base_nomalloc(scratch_group, group, permutation, n):
return 1
Expand Down
6 changes: 3 additions & 3 deletions src/sage/groups/perm_gps/partn_ref/double_coset.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ cdef int double_coset(void *S1, void *S2, PartitionStack *partition1, int *order
cdef OrbitPartition *orbits_of_subgroup
cdef OrbitPartition *orbits_of_supergroup
cdef int subgroup_primary_orbit_size = 0
cdef int minimal_in_primary_orbit
cdef int minimal_in_primary_orbit = 0

cdef bitset_t *fixed_points_of_generators # i.e. fp
cdef bitset_t *minimal_cell_reps_of_generators # i.e. mcr
Expand All @@ -347,8 +347,8 @@ cdef int double_coset(void *S1, void *S2, PartitionStack *partition1, int *order
cdef int *cells_to_refine_by
cdef int *vertices_determining_current_stack
cdef int *perm_stack
cdef StabilizerChain *group
cdef StabilizerChain *old_group
cdef StabilizerChain *group = NULL
cdef StabilizerChain *old_group = NULL
cdef StabilizerChain *tmp_gp

cdef int i, j, k, ell, b
Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ cdef class PartitionRefinement_generic:
`I`) and compute the `(I+J)`-semicanonical representative.
"""
cdef bint loc_inner_group_changed, reset_allowance_best = False
cdef int i, j, best_end, best_ind
cdef int i, j, best_end = 0, best_ind = 0

if self._is_candidate_initialized:
allowance_best = self._allowance_best[self._nr_of_inner_min_unmin_calls]
Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/perm_gps/permgroup_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement):
ValueError: invalid string to initialize a permutation
"""
cdef Py_ssize_t i=0, j
cdef int k, m
cdef int k = 0, m = 0
cdef str c
cdef list cycle
cdef dict convert_dict = self._parent._domain_to_gap
Expand Down
12 changes: 6 additions & 6 deletions src/sage/lfunctions/zero_sums.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1154,9 +1154,9 @@ cdef class LFunctionZeroSum_EllipticCurve(LFunctionZeroSum_abstract):
cdef double twopi = npi * 2
cdef double eg = self._euler_gamma

cdef double t, u, w, y, z, expt, bound1, logp, logq
cdef double thetap, thetaq, sqrtp, sqrtq, p, q
cdef int ap, aq
cdef double t, u, w, y, z = 0, expt, bound1, logp = 0, logq = 0
cdef double thetap = 0, thetaq = 0, sqrtp = 0, sqrtq = 0, p = 0, q
cdef int ap = 0, aq

cdef unsigned long n
cdef double N_double = self._level
Expand Down Expand Up @@ -1439,9 +1439,9 @@ cdef class LFunctionZeroSum_EllipticCurve(LFunctionZeroSum_abstract):
cdef double eg = self._euler_gamma
cdef double N_double = self._level

cdef double t, u, w, y, z, expt, bound1, logp, logq
cdef double thetap, thetaq, sqrtp, sqrtq, p, q
cdef int ap, aq
cdef double t, u, w, y, z = 0, expt, bound1, logp = 0, logq = 0
cdef double thetap = 0, thetaq = 0, sqrtp = 0, sqrtq = 0, p = 0, q
cdef int ap = 0, aq
cdef unsigned long n

# Compute bounds and smooth part of sum
Expand Down
10 changes: 10 additions & 0 deletions src/sage/libs/ntl/ntlwrap_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

#ifdef __cplusplus

/* Suppress unused-function warnings since this header contains optional utility functions */
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif

#include <iostream>
#include <sstream>
#include <gmp.h>
Expand Down Expand Up @@ -737,5 +743,9 @@ static void ZZ_pX_InvMod_newton_ram(struct ZZ_pX &x, const struct ZZ_pX &a, cons
delete xn;
}

#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#endif /* #ifdef __cplusplus */
#endif /* #ifndef _SAGE_NTLWRAP_CPP */
4 changes: 2 additions & 2 deletions src/sage/matrix/matrix0.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ cdef class Matrix(sage.structure.element.Matrix):
cdef list row_list
cdef list col_list
cdef Py_ssize_t i
cdef int row, col
cdef int row = 0, col = 0
cdef int nrows = self._nrows
cdef int ncols = self._ncols
cdef tuple key_tuple
Expand Down Expand Up @@ -1443,7 +1443,7 @@ cdef class Matrix(sage.structure.element.Matrix):
cdef list value_list
cdef bint value_list_one_dimensional = 0
cdef Py_ssize_t i
cdef Py_ssize_t row, col
cdef Py_ssize_t row = 0, col = 0
cdef Py_ssize_t nrows = self._nrows
cdef Py_ssize_t ncols = self._ncols
cdef tuple key_tuple
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matrix/matrix_gf2e_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense):
from sage.matrix.matrix_space import MatrixSpace

cdef Matrix_mod2_dense A
cdef int r,c
cdef int r = 0, c = 0

r, c = self.nrows(), self.ncols()
if r == 0 or c == 0:
Expand Down
Loading
Loading