Clojure 矩阵表示 [英] Clojure Matrix Representation

查看:16
本文介绍了Clojure 矩阵表示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Clojure 中矩阵的良好表示是什么?我对处理浮点数的密集矩阵很感兴趣.列表列表"表示法浮现在脑海中,但还有更好的方法吗?

What is a good representation for matrices in Clojure? I'm interested in dealing with dense matrices of floating point numbers. The "list of lists" representation springs to mind, but is there something better?

良好代表的一些标准包括:

Some criteria for a good representation include:

  • 效率:它们不会用于持续处理庞大的数据集,但我不想花费数小时来计算使用更好的设计本可以在几分钟内完成的结果.
  • Java 互操作性:在两种语言之间轻松地来回传递数据会很好.
  • 简单的并行化:如果我可以通过将 map 替换为 pmap 来使用所有可用的内核,那就太好了.
  • 易于使用 reduce:看起来我在使用 reduce 进行的很多计算都做得很好.
  • 在矩阵行中表示图像扫描线的能力:不是很重要,但会很好.
  • Efficiency: They won't be used for constant processing of huge data sets, but I don't want to spend hours calculating results that could have been done in minutes with a better design.
  • Java Interoperability: It would be nice to pass the data back and forth between the two languages easily.
  • Easy Parallelization: If I can use all the cores available simply by replacing map with pmap, that would be nice.
  • Amenable to the use of reduce: It seems like lots of the calculations I'm doing work very well with reduce.
  • Ability to Represent Image Scan Lines in Matrix Rows: Not really very important, but would be nice to have.

有什么想法吗?

推荐答案

Incanter 提供了一个包装器一些 Parallel Colt,包括看起来相当不错的快速实现,与 Clojure 的基于 seq 的库接口的并行化密集矩阵.我没用过,但应该是你要找的.

Incanter supplies a wrapper around some of Parallel Colt, including what looks to be a pretty decent implementation of fast, parallelized dense matrices that interface with Clojure's seq-based libraries. I haven't used it, but it should be what you're looking for.

示例.

这篇关于Clojure 矩阵表示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆