Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-baumann committed Mar 13, 2019
1 parent 4b5758d commit f34c35f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MultivariateFunctions"
uuid = "54e48022-12d0-513b-b20d-e273c072c6db"
authors = ["Stuart Baumann <[email protected]>"]
version = "0.1.6"
version = "0.1.7"

[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Expand Down
18 changes: 18 additions & 0 deletions src/3_1D_splines_and_interpolation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ end

"""
create_constant_interpolation_to_right(x::Array{Date,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
create_constant_interpolation_to_right(x::Array{DatePeriod,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
create_constant_interpolation_to_right(x::Array{Float64,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
Create a piecewise constant one-dimensional function which carries values from the left to the right.
Expand All @@ -53,6 +54,11 @@ function create_constant_interpolation_to_right(x::Array{Date,1},y::Array{Float6
return create_constant_interpolation_to_right(x_Float,y; dim_name = dim_name)
end

function create_constant_interpolation_to_right(x::Array{DatePeriod,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
x_as_Float64s = period_length.(x)
return create_constant_interpolation_to_right(x_as_Float64s, y; dim_name = dim_name)
end

function create_constant_interpolation_to_right(x::Array{Float64,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
x_ = vcat(-Inf,x)
y = vcat(y[1], y)
Expand All @@ -63,6 +69,7 @@ end

"""
create_constant_interpolation_to_left(x::Array{Date,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
create_constant_interpolation_to_left(x::Array{DatePeriod,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
create_constant_interpolation_to_left(x::Array{Float64,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
Create a piecewise constant one-dimensional function which carries values from the right to the left.
Expand All @@ -72,6 +79,11 @@ function create_constant_interpolation_to_left(x::Array{Date,1},y::Array{Float64
return create_constant_interpolation_to_left(x_Float , y ; dim_name = dim_name)
end

function create_constant_interpolation_to_left(x::Array{DatePeriod,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
x_as_Float64s = period_length.(x)
return create_constant_interpolation_to_left(x_as_Float64s, y; dim_name = dim_name)
end

function create_constant_interpolation_to_left(x::Array{Float64,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
x_ = vcat(-Inf,x[1:(length(x)-1)])
funcs_ = PE_Function.(y)
Expand All @@ -81,6 +93,7 @@ end

"""
create_linear_interpolation(x::Array{Date,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
create_linear_interpolation(x::Array{DatePeriod,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
create_linear_interpolation(x::Array{Float64,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
Create a piecewise linear one-dimensional function which interpolates linearly between datapoints.
Expand All @@ -90,6 +103,11 @@ function create_linear_interpolation(x::Array{Date,1},y::Array{Float64,1}; dim_n
return create_linear_interpolation(x_Float,y; dim_name = dim_name)
end

function create_linear_interpolation(x::Array{DatePeriod,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
x_as_Float64s = period_length.(x)
return create_linear_interpolation(x_as_Float64s, y; dim_name = dim_name)
end

function create_linear_interpolation(x::Array{Float64,1},y::Array{Float64,1}; dim_name::Symbol = default_symbol)
len = length(x)
if len < 2
Expand Down

0 comments on commit f34c35f

Please sign in to comment.