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: test/sdesystem.jl
+43-1Lines changed: 43 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -869,6 +869,48 @@ end
869
869
@testlength(observed(sys)) ==1
870
870
end
871
871
872
+
@testset"SDEFunctionExpr"begin
873
+
@parameters σ ρ β
874
+
@variablesx(tt) y(tt) z(tt)
875
+
876
+
eqs = [D(x) ~ σ * (y - x),
877
+
D(y) ~ x * (ρ - z) - y,
878
+
D(z) ~ x * y - β * z]
879
+
880
+
noiseeqs = [0.1* x,
881
+
0.1* y,
882
+
0.1* z]
883
+
884
+
@named sys =ODESystem(eqs, tt, [x, y, z], [σ, ρ, β])
885
+
886
+
@named de =SDESystem(eqs, noiseeqs, tt, [x, y, z], [σ, ρ, β], tspan = (0.0, 10.0))
887
+
de =complete(de)
888
+
889
+
f =SDEFunctionExpr(de)
890
+
@test f isa Expr
891
+
892
+
@testset"Configuration Tests"begin
893
+
# Test with `tgrad`
894
+
f_tgrad =SDEFunctionExpr(de; tgrad =true)
895
+
@test f_tgrad isa Expr
896
+
897
+
# Test with `jac`
898
+
f_jac =SDEFunctionExpr(de; jac =true)
899
+
@test f_jac isa Expr
900
+
901
+
# Test with sparse Jacobian
902
+
f_sparse =SDEFunctionExpr(de; sparse =true)
903
+
@test f_sparse isa Expr
904
+
end
905
+
906
+
@testset"Ordering Tests"begin
907
+
dvs = [z, y, x]
908
+
ps = [β, ρ, σ]
909
+
f_order =SDEFunctionExpr(de, dvs, ps)
910
+
@test f_order isa Expr
911
+
end
912
+
end
913
+
872
914
@testset"SDESystem Equality with events"begin
873
915
@variablesX(t)
874
916
@parameters p d
@@ -911,4 +953,4 @@ end
911
953
@test_throwsErrorException("SDESystem constructed by defining Brownian variables with @brownian must be simplified by calling `structural_simplify` before a SDEProblem can be constructed.") SDEProblem(de, u0map, (0.0, 100.0), parammap)
912
954
de =structural_simplify(de)
913
955
@testSDEProblem(de, u0map, (0.0, 100.0), parammap) isa SDEProblem
0 commit comments