Questions tagged [iteration]
Iterations are the successive repetitions in loops such as for, foreach or while. Questions with this tag are often concerned about how to best handle a collection of data.
iteration
2,145
questions with no upvoted or accepted answers
8
votes
1
answer
914
views
What makes python's itertools.groupby so fast?
I am evaluating successive terms of the look and say sequence (more about it here: https://en.wikipedia.org/wiki/Look-and-say_sequence).
I used two approaches and timed them both. In the first ...
5
votes
2
answers
185
views
Iterate a list without next()
I have a list called current_month_list which is populated each month with Mondays in the month. ie for June it would be:
current_month_list = 6, 13, 20, 27
Im using
next_rubbish_day = next(x for x ...
5
votes
1
answer
153
views
How do I organize these related indices into something that can be looked up efficiently in Rust?
Background
In an algorithm called finite element method, a continuous region is discretized into repeated sections with consistent geometry, over which linked equations are formed based on the ...
5
votes
1
answer
390
views
Alternate way to do Iterative name/variables in Pythonic while loop
So I know that it is a kind of pythonic heresy to modify a variable name while iterating over it but I have been searching for a good pythonic way to do this and can figure it out. In statistical ...
5
votes
2
answers
3k
views
Implementing iterative solution of integral equation in Matlab
We have an equation similar to the Fredholm integral equation of second kind.
To solve this equation we have been given an iterative solution that is guaranteed to converge for our specific equation. ...
5
votes
3
answers
4k
views
table.insert/remove by value
I got two tables, for example:
table1 = { element1, element2, element3, element4 }
table2 = { element1, element3 }
Table 2 refers to some elements of table1, but I don't know which exactly, nor I ...
4
votes
2
answers
1k
views
How to do uncertainty propagation within pandas dataframe (geochemical data reduction)
I have geochemical analyses (isotope ratios with associated analytical error) for which I am trying to calculate the chemical concentration based on my standard calibration curve.
I have four days of ...
4
votes
1
answer
6k
views
BFS: recursive vs iterative
Are there any advantages to writing a BFS tree-traversal algorithm recursively vs iteratively? It seems to me iterative is the way to go since it can be implemented in a simple loop:
Enqueue root ...
4
votes
1
answer
893
views
How do I iterate over a SPARQL query referring to a virtual graph?
I am developing a Virtuoso stored procedure.
I want to perform a loop over the result of a SPARQL query to a graph.
The problem comes when the query contains a reference to a virtual graph (a graph ...
4
votes
2
answers
144
views
Combining linked lists iteratively
I'm trying to combine two linked lists iteratively, but what I have right now is giving me the reverse of the result. Is there a way to combine the lists in the correct order without having to reverse ...
4
votes
3
answers
4k
views
Compute numpy array pairwise Euclidean distance except with self
edit: this question is not specifically about calculating distances, rather the most efficient way to loop through a numpy array, specifying that for index i all comparisons should be made with the ...
4
votes
0
answers
2k
views
r - How to know at which iteration a warning message is evoked
I'm doing logit regression on a pretty big database.
Basically, I have more than 600 dependent variable, and I have to perform more than 600 logit regression.
To do this I just did a simple script ...
4
votes
1
answer
736
views
getting started with loops and iteration in sequel pro
I'm using sequel pro to select data from several tables. There are two things I need to do that seem to need a loop of some kind. I have never used any form of iteration in sql and can't find a ...
4
votes
0
answers
710
views
Java iterate huge database table
I have a programme in c# that iterates a very large database query using yield return. The calling method then works on each object by calling the IEnumerable in a parallel.for each. Java does not ...
3
votes
0
answers
55
views
Python: Iterating through 2 lists
I am trying to implement the following equation:
Where zc is an equally spaced range of values e.g.
t_array = np.arange(z_[0],z_[-1],0.01)
In this case
z_[0] = -15.336
z_[-1] = 15.336
I'm struggling ...