使用 F# 的 4 维以上数组 - 无法初始化对象

发布于 2024-11-29 18:24:59 字数 539 浏览 3 评论 0原文

我使用 HDF5DotNet(参见 http://hdf5.net/)。有一个类 H5Array ,它有很多这种类型的构造函数:

new 'Type []
new 'Type [,]
new 'Type [,,]
new 'Type [,,]
new 'Type [,,,]
new 'Type [,,,,]
new 'Type [,,,,,]
...

我写

let data = Array2D.create 256 512 4.
let test = H5Array data

即使对于 2D 数组,我也会收到一条错误消息:

内部错误:F# 支持最大 .NET 数组维度为 4

我的两个问题是:

  1. 如何使其适用于 2D 数据?
  2. 如何让它适用于4维以上的数据?

I play with HDF5DotNet (see http://hdf5.net/). There is a class H5Array which has a lot of constructors of this kind:

new 'Type []
new 'Type [,]
new 'Type [,,]
new 'Type [,,]
new 'Type [,,,]
new 'Type [,,,,]
new 'Type [,,,,,]
...

I write

let data = Array2D.create 256 512 4.
let test = H5Array data

Even for a 2D array I get an error saying:

internal error: F# supports a maxiumum .NET array dimension of 4

My two questions are:

  1. How to make it work for the 2D data?
  2. How to make it work for more than 4 dimensional data?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

许久 2024-12-06 18:24:59

嗯,对于问题#2,我希望您使用 Array.Create

http:// /msdn.microsoft.com/en-us/library/dfs8044k.aspx

制作具有大秩的数组。但我想知道#1 是否是编译器错误?

Hm, for question #2, I expect you'd use Array.Create

http://msdn.microsoft.com/en-us/library/dfs8044k.aspx

to make arrays with large rank. But I wonder if #1 is a compiler bug?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文