You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/build_function.jl
+47-10Lines changed: 47 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -167,7 +167,7 @@ function _build_function(target::JuliaTarget, rhss, args...;
167
167
checkbounds =false, constructor=nothing,
168
168
linenumbers =false, multithread=nothing,
169
169
headerfun=addheader, outputidxs=nothing,
170
-
parallel=SerialForm())
170
+
skipzeros =false, parallel=SerialForm())
171
171
172
172
if multithread isa Bool
173
173
@warn("multithraded is deprecated for the parallel argument. See the documentation.")
@@ -202,18 +202,55 @@ function _build_function(target::JuliaTarget, rhss, args...;
202
202
_rhss = rhss
203
203
end
204
204
205
-
ifis_array_array_sparse_matrix(rhss) # Array of arrays of sparse matrices
206
-
ip_sys_exprs =reduce(vcat,[vec(reduce(vcat,[vec([:($X[$i][$j].nzval[$k] =$(conv(rhs))) for (k, rhs) ∈enumerate(rhsel2.nzval)]) for (j, rhsel2) ∈enumerate(rhsel)], init=Expr[])) for (i,rhsel) ∈enumerate(_rhss)],init=Expr[])
207
-
elseifis_array_array_matrix(rhss) # Array of arrays of arrays
208
-
ip_sys_exprs =reduce(vcat,[vec(reduce(vcat,[vec([:($X[$i][$j][$k] =$(conv(rhs))) for (k, rhs) ∈enumerate(rhsel2)]) for (j, rhsel2) ∈enumerate(rhsel)], init=Expr[])) for (i,rhsel) ∈enumerate(_rhss)], init=Expr[])
209
-
elseifis_array_sparse_matrix(rhss) # Array of sparse matrices
210
-
ip_sys_exprs =reduce(vcat,[vec([:($X[$i].nzval[$j] =$(conv(rhs))) for (j, rhs) ∈enumerate(rhsel.nzval)]) for (i,rhsel) ∈enumerate(_rhss)], init=Expr[])
205
+
ip_sys_exprs = Expr[]
206
+
ifis_array_array_sparse_matrix(rhss) # Array of arrays of sparse matrices
207
+
for (i, rhsel) ∈enumerate(_rhss)
208
+
for (j, rhsel2) ∈enumerate(rhsel)
209
+
for (k, rhs) ∈enumerate(rhsel2.nzval)
210
+
rhs′ =conv(rhs)
211
+
(skipzeros && rhs′ isa Number &&iszero(rhs′)) &&continue
0 commit comments