|
129 | 129 |
|
130 | 130 | @inline __dot(x, y) = dot(_vec(x), _vec(y)) |
131 | 131 |
|
132 | | -# Return an ImmutableNLStats object when we know that NLStats won't be updated |
133 | | -""" |
134 | | - ImmutableNLStats(nf, njacs, nfactors, nsolve, nsteps) |
135 | | -
|
136 | | -Statistics from the nonlinear equation solver about the solution process. |
137 | | -
|
138 | | -## Fields |
139 | | -
|
140 | | - - nf: Number of function evaluations. |
141 | | - - njacs: Number of Jacobians created during the solve. |
142 | | - - nfactors: Number of factorzations of the jacobian required for the solve. |
143 | | - - nsolve: Number of linear solves `W \\ b` required for the solve. |
144 | | - - nsteps: Total number of iterations for the nonlinear solver. |
145 | | -""" |
146 | | -struct ImmutableNLStats |
147 | | - nf::Int |
148 | | - njacs::Int |
149 | | - nfactors::Int |
150 | | - nsolve::Int |
151 | | - nsteps::Int |
152 | | -end |
153 | | - |
154 | | -function Base.show(io::IO, ::MIME"text/plain", s::ImmutableNLStats) |
155 | | - println(io, summary(s)) |
156 | | - @printf io "%-50s %-d\n" "Number of function evaluations:" s.nf |
157 | | - @printf io "%-50s %-d\n" "Number of Jacobians created:" s.njacs |
158 | | - @printf io "%-50s %-d\n" "Number of factorizations:" s.nfactors |
159 | | - @printf io "%-50s %-d\n" "Number of linear solves:" s.nsolve |
160 | | - @printf io "%-50s %-d" "Number of nonlinear solver iterations:" s.nsteps |
161 | | -end |
162 | | - |
163 | | -function Base.merge(s1::ImmutableNLStats, s2::ImmutableNLStats) |
164 | | - return ImmutableNLStats(s1.nf + s2.nf, s1.njacs + s2.njacs, s1.nfactors + s2.nfactors, |
165 | | - s1.nsolve + s2.nsolve, s1.nsteps + s2.nsteps) |
166 | | -end |
167 | | - |
168 | 132 | """ |
169 | 133 | pickchunksize(x) = pickchunksize(length(x)) |
170 | 134 | pickchunksize(x::Int) |
|
0 commit comments