Skip to content

Commit e206e94

Browse files
JamesWrigleyChrisRackauckas
authored andcommitted
Add an overload for ScalarModel to operate in-place
Also fixed the version number, which was accidentally bumped in a previous PR.
1 parent 128fe91 commit e206e94

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "CurveFit"
22
uuid = "5a033b19-8c74-5913-a970-47c3779ef25c"
3-
version = "1.5.0"
3+
version = "1.4.0"
44
authors = ["Paulo José Saiz Jabardo <pjabardo@gmail.com>, Avik Pal <avikpal@mit.edu> and contributors"]
55

66
[deps]

docs/src/_changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ CurrentModule = CurveFit
77
This documents notable changes in CurveFit.jl. The format is based on [Keep a
88
Changelog](https://keepachangelog.com).
99

10-
## [v1.4.0] - 2026-01-30
10+
## [v1.4.0] - 2026-01-31
1111

1212
### Added
1313
- Implemented [`margin_error()`](@ref) ([#81]).
1414
- Added support for standard deviation weights for linear fits ([#80]).
1515

16+
### Changed
17+
- [`ScalarModel()`](@ref)'s will now operate in-place for improved performance
18+
([#82]).
19+
1620
## [v1.3.0] - 2026-01-26
1721

1822
### Added

src/common_interface.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ struct ScalarModel{F}
176176
end
177177

178178
# When called with array data, broadcast over the data
179+
(sm::ScalarModel)(out, params, x::AbstractArray) = out .= sm.f.(Ref(params), x)
179180
(sm::ScalarModel)(params, x::AbstractArray) = sm.f.(Ref(params), x)
180181
# When called with scalar data (for single-point evaluation), call directly
181182
(sm::ScalarModel)(params, x::Number) = sm.f(params, x)

test/nonlinfit.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ end
239239

240240
# Use ScalarModel wrapper
241241
prob = NonlinearCurveFitProblem(ScalarModel(fn_scalar), [0.5, 0.5, 0.5], x, y)
242+
@test SciMLBase.isinplace(prob.nlfunc)
242243
sol = solve(prob)
244+
@test sol(x) isa Vector
243245

244246
@test sol.u a0
245247
@test SciMLBase.successful_retcode(sol.retcode)

0 commit comments

Comments
 (0)