【问题标题】:Memory exception from Math.NET when generating 100 x 100 data points生成 100 x 100 数据点时来自 Math.NET 的内存异常
【发布时间】:2016-10-31 20:49:26
【问题描述】:

当我尝试使用 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:对象引用未设置为对象的实例 在 Microsoft.FSharp.Core.Operators.FailurePattern (System.Exception 错误) [0x00001] 在 :0 在 Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ReraiseIfWatsonable (System.Exception exn) [0x0002d] 在 :0 在 Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range+range m) [0x00087] 在 中: 0 在 Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ReraiseIfWatsonable (System.Exception exn) [0x00040] 在 :0 在 Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range+range m) [0x00087] 在 中: 0 在 Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ReraiseIfWatsonable (System.Exception exn) [0x00040] 在 :0 在 Microsoft.FSharp.Compiler.ErrorLogger+ErrorLoggerExtensions.ErrorLogger.ErrorRecovery (Microsoft.FSharp.Compiler.ErrorLogger+ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range+range m) [0x00087] 在 中: 0

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

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

【问题讨论】:

  • 是什么让你认为它与记忆有关?那里没有说什么。如果内存确实是问题 - 在 Visual Studio 中,FSI 默认以 32 位运行,并且必须明确设置为 64 位。也许这在 XS 中是相似的。
  • LinearSpaced中的100是-10.0到10.0之间的点数。如果我降低点数,那么我不会得到例外。这让我相信它与记忆有关。
  • 我怀疑是内存问题。我在 Windows 上的 Visual Studio 中运行了您的代码,没有任何错误,您可以尝试运行与可执行文件相同的代码(无 FSI),看看是否遇到相同的错误?
  • Azure Notebooks 中的相同。即使数组 50x50 也会导致异常

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


【解决方案1】:

感谢您的意见。在可执行文件中运行时它可以正常工作,并且在从命令行运行交互式时也可以正常工作。我想这一定是Xamarin Studio下交互运行的集成问题。

【讨论】:

    猜你喜欢
    • 2010-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-17
    • 2015-07-13
    相关资源
    最近更新 更多