# Linear Algebra standardization in C++

**URL:** <https://fortran-lang.discourse.group/t/linear-algebra-standardization-in-c/3377>\
**Category:** Uncategorized\
**Created:** [May 4, 2022, 4:26pm UTC](https://fortran-lang.discourse.group/t/linear-algebra-standardization-in-c/3377 "2022-05-04T16:26:54Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [May 4, 2022, 5:41pm UTC](https://fortran-lang.discourse.group/t/linear-algebra-standardization-in-c/3377/2 "2022-05-04T17:41:32Z")

</div>

Thanks for sharing. It’s kind of provocative that the C++ folks are adopting a BLAS-like interface, while most contemporary Fortran users still go through the trouble of manually writing interfaces for the F77 routines (see [Pure wrappers for impure procedures](https://fortran-lang.discourse.group/t/pure-wrappers-for-impure-procedures/3231)).

The [`mdspan`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r15.html) mentioned in proposal [P1673R7](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1673r7.html) sounds like the perfect container to wrap a Fortran array. You may have seen my recent experiment with the already standardized [`std::span`](https://en.cppreference.com/w/cpp/container/span) and [sorting in Fortran via C++](https://fortran-lang.discourse.group/t/fastest-sorting-for-a-specific-genre-of-unordered-numbers/3217/9) (_edit: I forgot to add the link_). I was pretty stunned by the simplicity of linking Fortran and C++. I think we should try and capitalise on these developments, or even get involved with the C++ community.

If a C++ BLAS became available, with a bit of glue code and the tools in “ISO\_Fortran\_binding.h” it would be pretty straightforward to have a Fortran BLAS interface based upon the C++ one. I wonder if the people who submitted the proposal are aware of this and are pushing it also for altruistic reasons.

A few more thoughts:

- The C++ proposals discussed in the podcast were briefly mentioned in a previous post of mine - [Automatic object of parameterized derived type - #22 by ivanpribec](https://fortran-lang.discourse.group/t/automatic-object-of-parameterized-derived-type/1301/22). Back then I didn’t imagine there might be a day, where I’ll be linking a C++ BLAS into Fortran, but now it sure seems things are heading in that direction.
- Let’s not forget, with the right compile flags, Fortran compilers can already translate certain BLAS-like array expressions to optimised BLAS calls: [Mapping matrix & vector arithmetic to BLAS calls](https://fortran-lang.discourse.group/t/mapping-matrix-vector-arithmetic-to-blas-calls/3132). To achieve something similar in C++ would require expression templates, which are also mentioned in that proposal.

---

_[View the full topic](https://fortran-lang.discourse.group/t/linear-algebra-standardization-in-c/3377)._
