Skip to content

Complex numbers in Spline1D #76

@psteffensen

Description

@psteffensen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions