add handling of nonallocating functions, add plot option
This commit is contained in:
parent
422c4ab05a
commit
3b80b8c720
4 changed files with 62 additions and 8 deletions
23
test/nonallocating.jl
Normal file
23
test/nonallocating.jl
Normal file
|
@ -0,0 +1,23 @@
|
|||
@testset "Non-allocating functions" begin
|
||||
f! = (f_x, x) -> (f_x[1] = x[1]^2 - 2x[2]^2; f_x)
|
||||
Jf! = (Jf_x, x) -> (Jf_x[1] = 2x[1]; Jf_x[2] = -4x[2]; Jf_x)
|
||||
Hf! = (Hf_x, x) -> begin
|
||||
Hf_x[1, 1] = 2.0
|
||||
Hf_x[1, 2] = Hf_x[2, 1] = 0.0
|
||||
Hf_x[2, 2] = -4.0
|
||||
Hf_x
|
||||
end
|
||||
|
||||
size_f_x = (1,)
|
||||
size_Jf_x = (1, 2)
|
||||
size_Hf_x = (2, 2)
|
||||
|
||||
f_x = zeros(size_f_x...)
|
||||
Jf_x = zeros(size_Jf_x...)
|
||||
Hf_x = zeros(size_Hf_x...)
|
||||
|
||||
x = rand(2)
|
||||
|
||||
@test TaylorTest.check!(f!, Jf!, x, size_f_x, size_Jf_x)
|
||||
@test TaylorTest.check!(Jf!, Hf!, x, size_Jf_x, size_Hf_x)
|
||||
end
|
|
@ -9,3 +9,4 @@ include("trig_functions.jl")
|
|||
include("gauss.jl")
|
||||
include("erf.jl")
|
||||
include("tensors.jl")
|
||||
include("nonallocating.jl")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue