From 4078a9d868e041aff55e0fc66c7f5ab1cb3e9ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20Hoffimann?= Date: Mon, 28 Oct 2024 16:18:25 -0300 Subject: [PATCH] Refactor piecewiselinear.jl --- src/theoretical/transiogram/piecewiselinear.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/theoretical/transiogram/piecewiselinear.jl b/src/theoretical/transiogram/piecewiselinear.jl index 5ab7a58..6d4d246 100644 --- a/src/theoretical/transiogram/piecewiselinear.jl +++ b/src/theoretical/transiogram/piecewiselinear.jl @@ -21,7 +21,7 @@ obtained from an [`EmpiricalTransiogram`](@ref). struct PiecewiseLinearTransiogram{ℒ<:Len,M} <: Transiogram abscissas::Vector{ℒ} ordinates::Vector{M} - proportion::M + ordinfinity::M end function PiecewiseLinearTransiogram(abscissas::AbstractVector, ordinates::AbstractMatrix) @@ -38,9 +38,9 @@ function PiecewiseLinearTransiogram(abscissas::AbstractVector, ordinates::Abstra # proportion matrix p = normalize(diag(last(O)), 1) - P = SMatrix{m, m}(p[j] for i in 1:m, j in 1:m) + ∞ = SMatrix{m, m}(p[j] for i in 1:m, j in 1:m) - PiecewiseLinearTransiogram(a, O, P) + PiecewiseLinearTransiogram(a, O, ∞) end function (t::PiecewiseLinearTransiogram)(h) @@ -48,7 +48,7 @@ function (t::PiecewiseLinearTransiogram)(h) if h < first(hs) # left extrapolation ((first(hs) - h) * I + h * first(t.ordinates)) / first(hs) elseif h > last(hs) # right extrapolation - t.proportion + t.ordinfinity else # middle interpolation k = findfirst(≥(h), hs) ((hs[k + 1] - h) * t.ordinates[k] + (h - hs[k]) * t.ordinates[k + 1]) / (hs[k + 1] - hs[k])