JuliaMath / JuliaMath/Dierckx.jl

Complex numbers in Spline1D

Open
#76 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
173
Forks
30
PR merge metrics
No merged PRs in 30d

Description

I get an "inexacterror" when using a complex array of floats for Spline1D:

ERROR: InexactError: Float64(-1690.6161529533777 - 1214.84327391387im)

my_array looks like this:
```
julia> my_array[:]
12340-element Array{Complex{Float64},1}:
-1690.6161529533777 - 1214.84327391387im
-895.4613828155627 - 2012.3699900000424im
-981.8496071930282 - 2613.8440510838im
-1712.4126659718233 - 2936.555315343548im
-2492.559747350752 - 2996.238395928293im

-1837.6891112079963 + 528.5228512955363im
-3679.040165510708 + 849.8114560880327im
-4570.730515975646 + 789.0130974446927im
-4250.116932137339 + 354.47021983501594im
-3047.113151368609 - 366.1991927217247im
```

The code looks like this:
```
T_in = 1/fs_in
T_out = 1/fs_out

t_tot = length(my_array[:])*T_in
no_of_samples = round(t_tot/T_out)

t_in = 0:T_in:(length(my_array[:])-1)*T_in
t_out = 0:T_out:(no_of_samples-1)*T_out
spline = Spline1D(t_in, my_array[:]) # <-------- The inexact error occurs here
out = spline(t_out)

```

I works for a non-complex arrays.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.