File tree Expand file tree Collapse file tree 3 files changed +14
-16
lines changed Expand file tree Collapse file tree 3 files changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ DynamicPolynomials = "7c1d4256-1411-5781-91ec-d7bc3513ac07"
10
10
ElasticArrays = " fdbdab4c-e67f-52f5-8c3f-e7b388dad3d4"
11
11
FiniteDiff = " 6a86dc24-6348-571c-b903-95158fe2bd41"
12
12
IntervalTrees = " 524e6230-43b7-53ae-be76-1e9e4d08d11b"
13
+ IterTools = " c8e1da08-722c-5040-9ed9-7db0dc04731e"
13
14
LRUCache = " 8ac3fa9e-de4c-5943-b1dc-09c6b5f20637"
14
15
LinearAlgebra = " 37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
15
16
LoopVectorization = " bdcacae8-1622-11e9-2a5c-532679323890"
Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ Statistic about the number of (real) singular and non-singular solutions etc.
203
203
"""
204
204
statistics (r; kwargs... ) = ResultStatistics (r; kwargs... )
205
205
206
- const Results = Union{Result ,AbstractVector{<: PathResult }}
206
+ const Results = Union{AbstractResult ,AbstractVector{<: PathResult }}
207
207
208
208
"""
209
209
results(
@@ -231,13 +231,12 @@ function results(
231
231
only_finite:: Bool = true ,
232
232
multiple_results:: Bool = false ,
233
233
)
234
- [
235
- f (r) for r in R if (! only_real || is_real (r, real_tol)) &&
236
- (! only_nonsingular || is_nonsingular (r)) &&
237
- (! only_singular || is_singular (r)) &&
238
- (! only_finite || is_finite (r)) &&
239
- (multiple_results || ! is_multiple_result (r, R))
240
- ]
234
+ filter_function = r -> (! only_real || is_real (r, real_tol)) &&
235
+ (! only_nonsingular || is_nonsingular (r)) &&
236
+ (! only_singular || is_singular (r)) &&
237
+ (! only_finite || is_finite (r)) &&
238
+ (multiple_results || ! is_multiple_result (r, R))
239
+ imap (f,Iterators. filter (filter_function,R))
241
240
end
242
241
243
242
"""
Original file line number Diff line number Diff line change 10
10
bitmask,
11
11
bitmask_filter
12
12
13
+
14
+ using IterTools: imap
15
+
13
16
struct SolveStats
14
17
regular:: Threads.Atomic{Int}
15
18
regular_real:: Threads.Atomic{Int}
109
112
110
113
111
114
112
-
113
- function nsolutions (iter:: ResultIterator )
114
- mapreduce (x-> x. return_code== :success ,+ ,iter,init= 0 )
115
- end
116
-
117
115
function Base. length (ri:: ResultIterator )
118
116
if Base. IteratorSize (ri) == Base. SizeUnknown ()
119
117
k = 0
@@ -149,12 +147,12 @@ function trace(iter::ResultIterator)
149
147
mapreduce (x-> solution (x),+ ,iter,init= 0.0 .* s)
150
148
end
151
149
152
- function Result (iter :: ResultIterator )
153
- C = collect (iter )
150
+ function Result (ri :: ResultIterator )
151
+ C = collect (ri )
154
152
for i in 1 : length (C)
155
153
C[i]. path_number = i
156
154
end
157
- Result (C; seed = iter . S. seed, start_system = iter . S. start_system)
155
+ Result (C; seed = ri . S. seed, start_system = ri . S. start_system)
158
156
end
159
157
160
158
You can’t perform that action at this time.
0 commit comments