diff --git a/CHANGELOG.md b/CHANGELOG.md index 8790cbb..a5c739d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.2.1] + +### Fixed + +- variable `Npairs` to `Npoles` in `recommended_init_poles` +- prevent InexactError if `f` or `poles` were `Float` ## [0.2.0] - 2024-10-08 diff --git a/Project.toml b/Project.toml index 613a667..e8df7ac 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "RationalVectorFitting" uuid = "52b1e31a-230f-50d6-be04-0f5494ddfff6" authors = ["Pedro H. N. Vieira "] -version = "0.2.0" +version = "0.2.1" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/docs/src/ex1.svg b/docs/src/ex1.svg new file mode 100644 index 0000000..7c4e5da --- /dev/null +++ b/docs/src/ex1.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/ex2.svg b/docs/src/ex2.svg new file mode 100644 index 0000000..19a8d0d --- /dev/null +++ b/docs/src/ex2.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/ex3-mag.svg b/docs/src/ex3-mag.svg new file mode 100644 index 0000000..299080c --- /dev/null +++ b/docs/src/ex3-mag.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/ex3-phase.svg b/docs/src/ex3-phase.svg new file mode 100644 index 0000000..fee537f --- /dev/null +++ b/docs/src/ex3-phase.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/ex4-1.svg b/docs/src/ex4-1.svg new file mode 100644 index 0000000..997cf4c --- /dev/null +++ b/docs/src/ex4-1.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/ex4-2.svg b/docs/src/ex4-2.svg new file mode 100644 index 0000000..c60237b --- /dev/null +++ b/docs/src/ex4-2.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/ex4-3.svg b/docs/src/ex4-3.svg new file mode 100644 index 0000000..ffe4187 --- /dev/null +++ b/docs/src/ex4-3.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/ex4-4.svg b/docs/src/ex4-4.svg new file mode 100644 index 0000000..114c916 --- /dev/null +++ b/docs/src/ex4-4.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/RationalVectorFitting.jl b/src/RationalVectorFitting.jl index 27ec04a..f771890 100644 --- a/src/RationalVectorFitting.jl +++ b/src/RationalVectorFitting.jl @@ -58,17 +58,17 @@ end """ - recommended_init_poles(s, Npairs) -> init_poles + recommended_init_poles(s, Npoles) -> init_poles Builds a vector of recommended initial poles sorted by [`cplxpair`](@ref). """ -function recommended_init_poles(s, Npairs) +function recommended_init_poles(s, Npoles) s0 = imag(s[1]) if isapprox(s0, 0.0) s0 = imag(s[2]) end s1 = imag(s[end]) - init_poles = [(-0.01 + 1.0im) * sk for sk in range(s0, s1, length = Npairs ÷ 2)] + init_poles = [(-0.01 + 1.0im) * sk for sk in range(s0, s1, length = Npoles ÷ 2)] init_poles = sort!([init_poles; conj.(init_poles)], by = cplxpair) return init_poles end @@ -206,7 +206,7 @@ See also [`vector_fitting`](@ref), [`pole_identification`](@ref). function residue_identification(s, f, poles, weight) Ns = length(s) Np = length(poles) - residues = similar(poles) + residues = similar(poles, ComplexF64) Nrows = 2 * Ns Ncols = Np + 2 A1_cplx = zeros(ComplexF64, Ns, Ncols) @@ -316,7 +316,7 @@ function vector_fitting( residues = zeros(ComplexF64, Np, Nc) d = zeros(Nc) h = zeros(Nc) - fitted = similar(f) + fitted = similar(f, ComplexF64) local error_norm = Inf for iter = 1:maxiter if error_norm < tol