Skip to content

Commit

Permalink
updates for new Polynomials
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed May 28, 2020
1 parent f18b456 commit 85232ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MonteCarloMeasurements"
uuid = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
authors = ["baggepinnen <[email protected]>"]
version = "0.8.10"
version = "0.8.11"

[deps]
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Expand Down
16 changes: 8 additions & 8 deletions test/test_deconstruct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ ControlSystems.TransferFunction(matrix::Array{<:ControlSystems.SisoRational,2},
@test has_particles(P.matrix)
@test has_particles(P.matrix[1])
@test has_particles(P.matrix[1].num)
@test has_particles(P.matrix[1].num.a)
@test has_particles(P.matrix[1].num.a[1])
@test has_particles(P.matrix[1].num.coeffs)
@test has_particles(P.matrix[1].num.coeffs[1])

# P = tf(1 ± 0.1, [1, 1±0.1])
# @benchmark foreach(i->c2d($(tf(1.,[1., 1])),0.1), 1:N) # 1.7 ms 1.2 Mb
Expand All @@ -76,21 +76,21 @@ ControlSystems.TransferFunction(matrix::Array{<:ControlSystems.SisoRational,2},
resultsetter = MonteCarloMeasurements.get_result_setter(Pres)
@test all(1:paths[1][3]) do i
buffersetter(P,P2,i)
P.matrix[1].num.a[1][i] == P2.matrix[1].num.a[1] &&
P.matrix[1].den.a[2][i] == P2.matrix[1].den.a[2]
P.matrix[1].num.coeffs[1][i] == P2.matrix[1].num.coeffs[1] &&
P.matrix[1].den.coeffs[2][i] == P2.matrix[1].den.coeffs[2]
P2res = f(P2)
resultsetter(Pres, P2res, i)
Pres.matrix[1].num.a[1][i] == P2res.matrix[1].num.a[1] &&
Pres.matrix[1].den.a[2][i] == P2res.matrix[1].den.a[2]
Pres.matrix[1].num.coeffs[1][i] == P2res.matrix[1].num.coeffs[1] &&
Pres.matrix[1].den.coeffs[2][i] == P2res.matrix[1].den.coeffs[2]
end
end

@test mean_object(complex(1. ± 0.1, 1.)) isa ComplexF64
@test mean_object(complex(1. ± 0.1, 1.)) complex(1,1) atol=1e-3

Ps = MonteCarloMeasurements.make_scalar(P)
@test MonteCarloMeasurements.particletypetuple(Ps.matrix[1].num.a[1]) == (Float64,1,Particles)
@test MonteCarloMeasurements.particletypetuple(MonteCarloMeasurements.restore_scalar(Ps,50).matrix[1].num.a[1]) == (Float64,50,Particles)
@test MonteCarloMeasurements.particletypetuple(Ps.matrix[1].num.coeffs[1]) == (Float64,1,Particles)
@test MonteCarloMeasurements.particletypetuple(MonteCarloMeasurements.restore_scalar(Ps,50).matrix[1].num.coeffs[1]) == (Float64,50,Particles)

unsafe_comparisons(false)
end
Expand Down

0 comments on commit 85232ef

Please sign in to comment.