TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Introduction into Decomposition Methods of Linear Equation Systems in C++

3 点作者 TsukiZombina超过 5 年前

1 comment

Const-me超过 5 年前
The math parts are good. C++ parts are less so.<p>Arrays can be on the stack just as vectors. The main cause of performance difference between them is cache misses, stack is almost always well cached, newly allocated heap memory almost never.<p>It&#x27;s rarely a good idea to write matrix libraries these days. Eigen switched to developer-friendly MPL license in 2012, I&#x27;ve been using it since then and it&#x27;s awesome. It has substantially more internal complexity, but when used correctly it&#x27;s faster that naïve solutions by an order of magnitude. Template metaprogramming pays off for their use case.<p>Quite often you know sizes of your matrices at compile time. If that size is 3x3 or 27x27 or something else reasonably small, switching to compile time sized matrices can improve performance by a lot. These fixed-size matrices and vectors are essentially value types, they have no pointers to chase and they don&#x27;t use dynamic memory.<p>When you have complex formulae operating on vectors and matrices, if you use auto for intermediate variables, Eigen code often compiles into a single loop over the source data. These intermediate things of human-unfriendly types are essentially compile-time futures.