• <small id='3jUbU'></small><noframes id='3jUbU'>

    <tfoot id='3jUbU'></tfoot>

    1. <i id='3jUbU'><tr id='3jUbU'><dt id='3jUbU'><q id='3jUbU'><span id='3jUbU'><b id='3jUbU'><form id='3jUbU'><ins id='3jUbU'></ins><ul id='3jUbU'></ul><sub id='3jUbU'></sub></form><legend id='3jUbU'></legend><bdo id='3jUbU'><pre id='3jUbU'><center id='3jUbU'></center></pre></bdo></b><th id='3jUbU'></th></span></q></dt></tr></i><div id='3jUbU'><tfoot id='3jUbU'></tfoot><dl id='3jUbU'><fieldset id='3jUbU'></fieldset></dl></div>
        <bdo id='3jUbU'></bdo><ul id='3jUbU'></ul>

        <legend id='3jUbU'><style id='3jUbU'><dir id='3jUbU'><q id='3jUbU'></q></dir></style></legend>

        C++ 表达式模板

        时间:2023-05-24
        <legend id='sOShc'><style id='sOShc'><dir id='sOShc'><q id='sOShc'></q></dir></style></legend>

              <bdo id='sOShc'></bdo><ul id='sOShc'></ul>

              1. <tfoot id='sOShc'></tfoot>

                <small id='sOShc'></small><noframes id='sOShc'>

                    <tbody id='sOShc'></tbody>
                1. <i id='sOShc'><tr id='sOShc'><dt id='sOShc'><q id='sOShc'><span id='sOShc'><b id='sOShc'><form id='sOShc'><ins id='sOShc'></ins><ul id='sOShc'></ul><sub id='sOShc'></sub></form><legend id='sOShc'></legend><bdo id='sOShc'><pre id='sOShc'><center id='sOShc'></center></pre></bdo></b><th id='sOShc'></th></span></q></dt></tr></i><div id='sOShc'><tfoot id='sOShc'></tfoot><dl id='sOShc'><fieldset id='sOShc'></fieldset></dl></div>
                  本文介绍了C++ 表达式模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我目前使用 C 语言进行数值计算.我听说使用 C++ 表达式模板更适合科学计算.简单来说,什么是 C++ 表达式模板?

                  I currently use C for numerical computations. I've heard that using C++ Expression Templates is better for scientific computing. What are C++ Expression Templates in simple terms?

                  1. 是否有关于使用 C++ 表达式模板讨论数值方法/计算的书籍?

                  1. Are there books around that discuss numerical methods/computations using C++ Expression Templates?

                  在哪些方面,C++ 表达式模板比使用纯 C 更好?

                  In what way, C++ Expression Templates are better than using pure C?

                  推荐答案

                  简单来说什么是 C++ 表达式模板?

                  What are C++ Expression Templates in simple terms?

                  表达式模板 是一类 C++ 模板元编程,它延迟子表达式的计算直到完整表达式是已知的,因此可以应用优化(尤其是消除临时变量).

                  Expression templates are a category of C++ template meta programming which delays evaluation of subexpressions until the full expression is known, so that optimizations (especially the elimination of temporaries) can be applied.

                  是否有关于使用 C++ 表达式模板讨论数值方法/计算的书籍?

                  Are there books around that discuss numerical methods/computations using C++ Expression Templates?

                  我相信 ET 是由 Todd Veldhuizen 发明的,他在 15 年前发表了一篇关于它的论文.(似乎许多旧链接现在已经失效,但目前 here 是它的一个版本.)有关它的一些材料在 David Vandevoorde 和 Nicolai Josuttis 的 C++ 模板:完整指南.

                  I believe ET's were invented by Todd Veldhuizen who published a paper on it 15 years ago. (It seems that many older links to it are dead by now, but currently here is a version of it.) Some material about it is in David Vandevoorde's and Nicolai Josuttis' C++ Templates: The Complete Guide.

                  C++ 表达式模板在哪些方面比使用纯 C 更好?

                  In what way, C++ Expression Templates are better than using pure C?

                  它们允许您以富有表现力的高级方式编写代码而不会损失性能.例如,

                  They allow you to write your code in an expressive high level way without losing performance. For example,

                  void f(const my_array<double> a1, const my_array<double> a2) 
                  { 
                    my_array<double> a3 = 1.2 * a1 + a1 * a2; 
                    // ..
                  }
                  

                  可以一直优化到

                  for( my_array<double>::size_type idx=0; idx<a1.size(); ++idx ) 
                    a3[idx] = 1.2*a1[idx] + a1[idx]*a2[idx]; 
                  

                  这更快,但更难理解.

                  这篇关于C++ 表达式模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:模板元程序将类型转换为唯一编号 下一篇:工厂方法实现 - C++

                  相关文章

                  最新文章

                  <legend id='QPSA5'><style id='QPSA5'><dir id='QPSA5'><q id='QPSA5'></q></dir></style></legend>

                  <tfoot id='QPSA5'></tfoot>
                2. <small id='QPSA5'></small><noframes id='QPSA5'>

                      • <bdo id='QPSA5'></bdo><ul id='QPSA5'></ul>
                      <i id='QPSA5'><tr id='QPSA5'><dt id='QPSA5'><q id='QPSA5'><span id='QPSA5'><b id='QPSA5'><form id='QPSA5'><ins id='QPSA5'></ins><ul id='QPSA5'></ul><sub id='QPSA5'></sub></form><legend id='QPSA5'></legend><bdo id='QPSA5'><pre id='QPSA5'><center id='QPSA5'></center></pre></bdo></b><th id='QPSA5'></th></span></q></dt></tr></i><div id='QPSA5'><tfoot id='QPSA5'></tfoot><dl id='QPSA5'><fieldset id='QPSA5'></fieldset></dl></div>