I need to perform some basic OLS regression using F#. To do this I need some Linear Algebra functions, but I'm confused as to what's out there. I can't find any way to invert a matrix. There is some documentation for a library called Microsoft.FSharp.Math.LinearAlgebra
, but I don't know if that exists anymore.
我需要使用f#执行一些基本的OLS回归。要做到这一点,我需要一些线性代数函数,但我搞不清楚外面是什么。我找不到任何方法来逆变矩阵。有一些关于一个名为Microsoft.FSharp.Math的库的文档。线性代数,但我不知道它是否存在。
4 个解决方案
#1
6
If you add the FSharp Powerpack to your project (in .NET references), you can use various functionality of the matrix library
如果将FSharp Powerpack添加到项目中(在.NET引用中),可以使用矩阵库的各种功能
edit: you also need to add the experimental library Fsharp.Powerpack.MathProviders, then you can call as follows
编辑:您还需要添加实验库Fsharp.Powerpack。然后可以调用mathprovider,如下所示
open Microsoft.FSharp.Math
let m = Matrix.create 10 10 1.2
let m2 = Experimental.LinearAlgebra.Inverse m
#2
1
FlyingFrog do a Numerics library which contains Matrix inversion amongst many other functions.
FlyingFrog是一个数字库,它包含许多其他函数之间的矩阵反演。
Not sure which is preferable, that or the (apparently deprecated) 'experimental' code from the PowerPack. I guess you could always keep the source code for the managed bit of the PowerPack version in a safe place, still available here:
不知道哪个更好,那个还是那个(显然不赞成)来自PowerPack的“实验”代码。我猜你总是可以将PowerPack版本的托管代码的源代码保存在一个安全的地方,这里仍然可以使用:
C:\Program Files\FSharp-1.9.6.2\source\fsharp\FSharp.PowerPack\math\lapack\linear_algebra_managed.fs.
#3
0
I don't know; in the 1.9.6 version of F# I don't see anything offhand, the docs are here
我不知道;在1.9.6版本的f#中,我看不出有什么问题,文档在这里
http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/namespaces.html
http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/namespaces.html
and there is Matrix stuff in the Microsoft.FSharp.Math namespace in the FSharp.Powerpack.dll, but I don't see 'invert' offhand, and I don't know about the 'LinearAlgebra' stuff (deprecated? web search suggests it disappeared a few releases back).
在微软。fsharp里面有基质材料。FSharp.Powerpack中的Math名称空间。dll,但是我没看到“反转”,我不知道“线性代数”的东西(弃用?网络搜索显示,它在之前的几个版本中消失了)。
#1
6
If you add the FSharp Powerpack to your project (in .NET references), you can use various functionality of the matrix library
如果将FSharp Powerpack添加到项目中(在.NET引用中),可以使用矩阵库的各种功能
edit: you also need to add the experimental library Fsharp.Powerpack.MathProviders, then you can call as follows
编辑:您还需要添加实验库Fsharp.Powerpack。然后可以调用mathprovider,如下所示
open Microsoft.FSharp.Math
let m = Matrix.create 10 10 1.2
let m2 = Experimental.LinearAlgebra.Inverse m
#2
1
FlyingFrog do a Numerics library which contains Matrix inversion amongst many other functions.
FlyingFrog是一个数字库,它包含许多其他函数之间的矩阵反演。
Not sure which is preferable, that or the (apparently deprecated) 'experimental' code from the PowerPack. I guess you could always keep the source code for the managed bit of the PowerPack version in a safe place, still available here:
不知道哪个更好,那个还是那个(显然不赞成)来自PowerPack的“实验”代码。我猜你总是可以将PowerPack版本的托管代码的源代码保存在一个安全的地方,这里仍然可以使用:
C:\Program Files\FSharp-1.9.6.2\source\fsharp\FSharp.PowerPack\math\lapack\linear_algebra_managed.fs.
#3
0
I don't know; in the 1.9.6 version of F# I don't see anything offhand, the docs are here
我不知道;在1.9.6版本的f#中,我看不出有什么问题,文档在这里
http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/namespaces.html
http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/namespaces.html
and there is Matrix stuff in the Microsoft.FSharp.Math namespace in the FSharp.Powerpack.dll, but I don't see 'invert' offhand, and I don't know about the 'LinearAlgebra' stuff (deprecated? web search suggests it disappeared a few releases back).
在微软。fsharp里面有基质材料。FSharp.Powerpack中的Math名称空间。dll,但是我没看到“反转”,我不知道“线性代数”的东西(弃用?网络搜索显示,它在之前的几个版本中消失了)。