# 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:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![R\_cubed](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/r_cubed/32/263_2.png) [@R\_cubed](https://fortran-lang.discourse.group/u/R_cubed)\
**Post date:** [May 4, 2022, 4:26pm UTC](https://fortran-lang.discourse.group/t/linear-algebra-standardization-in-c/3377/1 "2022-05-04T16:26:54Z")

</div>

Thought this podcast might be of interest for scientific computing more generally.

> **[Linear Algebra Standardization](https://cppcast.com/linear-algebra-iso/)**
>
> Mark Hoemmen joins Rob and Jason. They first talk about an debugging improvements in VS Code and C++20/23 features going into MSVC. Then they talk to Mark Hoemmen about his past work on linear algebra libraries Tpetra and Kokkos, and current efforts...

---

<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.

---

<div class="post-metadata">

**Author:** ![shahmoradi](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/shahmoradi/32/3151_2.png) [@shahmoradi](https://fortran-lang.discourse.group/u/shahmoradi)\
**Post date:** [November 12, 2023, 7:37am UTC](https://fortran-lang.discourse.group/t/linear-algebra-standardization-in-c/3377/3 "2023-11-12T07:37:33Z")

</div>

The C++ standard committee apparently approved BLAS proposal today for addition to C++26.  
I am still looking forward to seeing multi-line doc-strings in a future Fortran standard.

---

<div class="post-metadata">

**Author:** ![Jweber](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Jweber](https://fortran-lang.discourse.group/u/Jweber)\
**Post date:** [January 4, 2024, 7:10pm UTC](https://fortran-lang.discourse.group/t/linear-algebra-standardization-in-c/3377/4 "2024-01-04T19:10:47Z")

</div>

There is an talk about the proposal to include  
linear algebra in C++ online:

[![](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/a/ac847311f753b5b7e6c96d85d6202f88d6457548.jpeg "std::linalg: Linear Algebra Coming to Standard C++ - Mark Hoemmen - CppCon 2023") ](https://www.youtube.com/watch?v=-UXHMlAMXNk)
