From 23409476e2fe0c67f599681519187285d6fc4bf9 Mon Sep 17 00:00:00 2001 From: "Oliver J. Woodford" Date: Fri, 29 Nov 2024 13:13:52 +0000 Subject: [PATCH] Fix memory bug (#46) Univariate problems were assumed to be small. When this wasn't the case, the resulting static arrays were too big, causing an error. This fixes the problem. --- Project.toml | 2 +- src/structs.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 750d875..1ca12b2 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "NLLSsolver" uuid = "50b5cf9e-bf7a-4e29-8981-4280cbba70cb" authors = ["Oliver Woodford"] -version = "4.0.0" +version = "4.0.1" [deps] DiffResults = "163ba53b-c6d8-5494-b064-1a9d43ac40c5" diff --git a/src/structs.jl b/src/structs.jl index 78ea2cd..35789ff 100644 --- a/src/structs.jl +++ b/src/structs.jl @@ -102,7 +102,7 @@ mutable struct NLLSInternal{LSType} return new{LSType}(0., 0., starttimens, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, linsystem) end end -NLLSInternal(unfixed::UInt, varlen, starttimens) = NLLSInternal(ifelse(is_static(varlen), UniVariateLSstatic{dynamic(varlen), dynamic(varlen*varlen)}(unfixed), UniVariateLSdynamic(unfixed, dynamic(varlen))), starttimens) +NLLSInternal(unfixed::UInt, varlen, starttimens) = NLLSInternal(dynamic(is_static(varlen)) && varlen <= 16 ? UniVariateLSstatic{dynamic(varlen), dynamic(varlen*varlen)}(unfixed) : UniVariateLSdynamic(unfixed, dynamic(varlen)), starttimens) getresult(data::NLLSInternal) = NLLSResult(data.startcost, data.bestcost, data.timetotal*1.e-9, data.timeinit*1.e-9, data.timecost*1.e-9, data.timegradient*1.e-9, data.timesolver*1.e-9, data.converged, data.iternum, data.costcomputations, data.gradientcomputations, data.linearsolvers)