.net - 生成 100 x 100 数据点时来自 Math.NET 的内存异常

标签 .net f# f#-interactive mathnet-numerics

当我尝试使用 F# 和 Math.NET 使用以下代码生成 100 x 100 数据点时:

let theta0_vals = Generate.LinearSpaced(100, -10.0, 10.0)
let theta1_vals = Generate.LinearSpaced(100, -1.0, 4.0)

let fct a b = 2.0 * a * b

let points = [for i in theta0_vals -> [for j in theta1_vals -> fct (float i) (float j) ]]

然后我得到以下异常:

[System.NullReferenceException: Object reference not set to an instance of an object   at Microsoft.FSharp.Core.Operators.FailurePattern (System.Exception error) [0x00001] in <57a12c4adff9fae1a74503834a2ca157>:0   at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ReraiseIfWatsonable (System.Exception exn) [0x0002d] in <5707a356ddab8ea7a745038356a30757>:0   at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range+range m) [0x00087] in <5707a356ddab8ea7a745038356a30757>:0   at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ReraiseIfWatsonable (System.Exception exn) [0x00040] in <5707a356ddab8ea7a745038356a30757>:0   at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range+range m) [0x00087] in <5707a356ddab8ea7a745038356a30757>:0   at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ReraiseIfWatsonable (System.Exception exn) [0x00040] in <5707a356ddab8ea7a745038356a30757>:0   at Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range+range m) [0x00087] in <5707a356ddab8ea7a745038356a30757>:0

我在配备 16 GB 内存的 Mac 上的 Xamarin Studio 中使用 F# 交互式。我在 Matlab 中做同样的事情没有问题。

这是 F# 和/或 Math.NET 的限制吗?

最佳答案

感谢您的输入。它在可执行文件中运行时工作正常,并且在从命令行运行交互式时也能正常工作。我想应该是 Xamarin Studio 下运行的交互集成的问题。

关于.net - 生成 100 x 100 数据点时来自 Math.NET 的内存异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40350362/

相关文章:

时间:2019-01-17 标签:c#Windowsforms 'Object reference not set to an instance of an object'

f# - 从 F# 引用可执行文件

.net - F# TypeProvider 无法加载类型

recursion - 数学表达式简化 f#

.net - .net Framework的产品代码

c# - 如何将属性添加到标有 XmlArrayAttribute 的集合中?

c# - WPF动画回调函数

.net - F# 函数在没有被调用的情况下运行

.net - 在 F# Interactive 中创建新的 AppDomain

string - F# 如何使用字符串输入解析和评估计算器表达式