I am trying to add a method to the DenseVector class to be able to difference the vector n times. The following doesn't seem to work as type inference complains that the type Vector is not compatible with the type DenseVector:
open System
open System.IO
open Deedle
open MathNet.Numerics
open MathNet.Numerics.LinearAlgebra
open MathNet.Numerics.LinearAlgebra.Double
open MathNet.Numerics.Distributions
[<Extension>]
type DenseVector with
member this.diffVector (v : DenseVector) (n : int) =
let rec run (v : DenseVector) (n : int) =
match n with
| 0 -> v
| _ -> run (v.[ 1 .. v.Count-1 ] - v.[ 0 .. (v.Count-1)-1 ]) (n - 1)
run v n
v.[ 0 .. (v.Count-1)-1 ]
in the above is causing problems. Why is it being inferred as Vector and not DenseVector which is what is passed to the function? Also, is my way of adding the extension method correct?