fslaborg / Deedle

Easy to use .NET library for data and time series manipulation and for scientific programming
http://fslab.org/Deedle/
BSD 2-Clause "Simplified" License
924 stars 196 forks source link

Error when performing linearInterpolation from C# #464

Closed grisharav closed 5 years ago

grisharav commented 5 years ago

Version 2.0.0 throws on linear interpolation when trying to be called from C#:

System.NotSupportedException : Dynamic invocation of op_Explicit is not supported
   at <StartupCode$Deedle>.$SeriesStatsExtensions.InterpolateLinear@174-2.Invoke(V value) in c:\FSharp\zhuz\Deedle\src\Deedle\SeriesStatsExtensions.fs:line 174
   at <StartupCode$Deedle>.$Series.f@345-17[K,V,R](Func`2 f, KeyValuePair`2 kvp, V v) in c:\FSharp\zhuz\Deedle\src\Deedle\Series.fs:line 401
   at <StartupCode$Deedle>.$Series.Select@399-1.Invoke(KeyValuePair`2 kvp) in c:\FSharp\zhuz\Deedle\src\Deedle\Series.fs:line 400
   at <StartupCode$Deedle>.$ArrayVector.data@374-6.Invoke(Int32 i, T v) in c:\FSharp\zhuz\Deedle\src\Deedle\Vectors\ArrayVector.fs:line 374
   at Microsoft.FSharp.Collections.ArrayModule.MapIndexed[T,TResult](FSharpFunc`2 mapping, T[] array)
   at Deedle.Vectors.ArrayVector.ArrayVector`1.Deedle-IVector`1-Select[TNewValue](FSharpFunc`2 f) in c:\FSharp\zhuz\Deedle\src\Deedle\Vectors\ArrayVector.fs:line 374
   at Deedle.Series`2.SelectOptional[R](Func`2 f) in c:\FSharp\zhuz\Deedle\src\Deedle\Series.fs:line 415
   at Deedle.SeriesStatsExtensions.InterpolateLinear[K,V](Series`2 series, IEnumerable`1 keys, Func`3 keyDiff)
...

This didn't happen with the 2.0.0-beta1

Maybe it has to do with the inline feature of F# (https://stackoverflow.com/questions/40850712/operator-used-in-f-raises-specified-method-is-not-supported-exception-from). I saw that the code is indeed marked inline...

FoggyFinder commented 5 years ago

Duplicate of #457

grisharav commented 5 years ago

Thanks, I don't have any workarounds for now, right? Any ideas when the fix shall be released?

FoggyFinder commented 5 years ago

Thanks, I don't have any workarounds for now, right?

I'm optimistic: workarounds are always exists :-) Seems like the easiest way is built library from source and use it until next version will be released.

Any ideas when the fix shall be released?

dunno. Let's ask @zyzhu

zyzhu commented 5 years ago

I've just published 2.0.1. Please test it and let me know.

zyzhu commented 5 years ago

BTW, @FoggyFinder, are you interested to become a co-maintainer of Deedle?

grisharav commented 5 years ago

Thanks @zyzhu, updated to 2.0.1, all seems to work fine

FoggyFinder commented 5 years ago

BTW, @FoggyFinder, are you interested to become a co-maintainer of Deedle?

@zyzhu Thank you. Being usual contributor is fine to me. Maintaining project is many responsibility. I'm not ready - at least yet.

zyzhu commented 5 years ago

@FoggyFinder Sure! Thanks for your contributions!