D的快速线性系统求解器? [英] Fast linear system solver for D?

查看:91
本文介绍了D的快速线性系统求解器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在哪里可以获得用D编写的快速线性系统求解器?它应能够采用方阵 A 和向量 b 并求解方程 Ax = b b ,并且最好在 A 上执行显式倒置.我有一个我自己写的,但是它很慢,可能是因为它完全是幼稚的.但是,对于我的用例,我需要具有以下 绝对的,不可协商的 要求的东西,即,如果不满足这些要求,那么我不在乎否则效果如何?

Where can I get a fast linear system solver written in D? It should be able to take a square matrix A and a vector b and solve the equation Ax = b for b and, ideally, also perform explicit inversion on A. I have one I wrote myself, but it's pretty slow, probably because it's completely cache-naive. However, for my use case, I need something with the following absolute, non-negotiable requirements, i.e. if it doesn't meet these, then I don't otherwise care how good it otherwise is:

  1. 必须已获得公共域许可,Boost许可或某些类似的宽松许可.理想情况下,它不需要二进制文件(即BSD)的归属,尽管这一点可以商议.

  1. Must be licensed public domain, Boost license, or some similar permissive license. Ideally it should not require attribution in binaries (i.e. not BSD), though this point is somewhat negotiable.

必须用纯D编写或易于翻译成纯D.无论速度如何,难以理解的Fortran代码(例如LAPACK)都不是一个好答案.

Must be written in pure D or easily translatable to pure D. Inscrutable Fortran code (i.e. LAPACK) is not a good answer no matter how fast it is.

必须针对大型(即n> 1000)系统进行优化.我不想为游戏程序员设计真正,非常快地解决4x4矩阵的东西.

Must be optimized for large (i.e. n > 1000) systems. I don't want something that's designed for game programmers to solve 4x4 matrices really, really fast.

一定不要与我不需要的庞大资料库密不可分.

Must not be inextricably linked to a huge library of stuff I don't need.

这些看似疯狂的要求的原因是,对于不需要第三方依赖项的许可许可开放源代码库,我需要此代码.

The reason for these seemingly insane requirements is that I need this code for a permissively licensed open source library that I don't want to have any third-party dependencies.

推荐答案

如果您不喜欢Fortran代码,那是一个相当快的C ++密集矩阵库,具有适度的多核支持,编写良好的代码和良好的用户界面是本征.将其代码转换为D(或从中获取一些算法)应该很简单.

If you don't like Fortran code, one reasonably fast C++ dense matrix library with modest multi-core support, well-written code and a good user-interface is Eigen. It should be straightforward to translate its code to D (or to take some algorithms from it).

现在我的思考您的要求":有一个原因使每个人"(Mathematica,Matlab,Maple,SciPy,GSL,R等)都使用ATLAS/LAPACK,UMFPACK,PARDISO,CHOLMOD等.编写快速,多线程,内存高效,可移植且数值稳定的矩阵求解器非常困难(请相信我,我已经尝试过).许多艰苦的工作已经投入了ATLAS和其他工作.

And now my "think about your requirements": there is a reason why "everyone" (Mathematica, Matlab, Maple, SciPy, GSL, R, ...) uses ATLAS / LAPACK, UMFPACK, PARDISO, CHOLMOD etc. It is hard work to write fast, multi-threaded, memory-efficient, portable and numerically stable matrix solvers (trust me, I have tried). A lot of this hard work has gone into ATLAS and the rest.

所以我的方法是根据您的矩阵类型为相关库编写绑定,并从D链接到C接口.也许 multiarray 中的绑定就足够了(我没有尝试过).否则,建议您查看另一个C ++库,即绑定以获取想法.

So my approach would be to write bindings for the relevant library depending on your matrix type, and link from D against the C interfaces. Maybe the bindings in multiarray are enough (I haven't tried). Otherwise, I'd suggest looking at another C++ library, namely uBlas and the respective bindings for ideas.

这篇关于D的快速线性系统求解器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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