3 ms·
Not to mention all of that array behavior is available on the standard C++ library with std::valarray<T>, e.g., https://godbolt.org/g/JBSvuH https://godbolt.org
by pbsd 10y ago
Not to mention all of that array behavior is available on the standard C++ library with std::valarray<T>, e.g., https://godbolt.org/g/JBSvuH https://godbolt.org/g/JBSvuH. There was talk of a more thorough standard multi-dimensional array type, but I have no idea what's the status on that.
- sampo 10y agoGotta admit that array slicing syntax is still friendlier in Fortran a = [1,2,3,4,5,6] a(1:3) ! gives [1,2,3] than with std::valarray a = {1,2,3,4,5,6}; a[slice(0,3,0)]; // gives {1,2,3} And I couldn't even find examples on how to do slicing with multi-dimensional arrays in std::valarray? In Fortran it's just a(1:3,1:3)
- pbsd 10y agostd::valarray does not have multidimensional support at all. In fact, std::valarray is a relatively abandoned part of the standard library. You'll have to go with one of the 3rd party libraries for better support. My point was not so much that valarray is awesome, but that articles like this one tend to fight a very strawman version of C++, even when just sticking to strictly standard components.
- KKKKkkkk1 10y agoIf anything, saying that C++ has no support for linear algebra is giving it too much credit. C++ has an abundance of libraries that are broken in various strange and marvelous ways. Typically, you find out about the brokenness only after you made the investment of learning the library and put it into production, so that there is no way back. Your comment about valarray is a good example of this.
- pbsd 10y agoThat's a criticism I'm entirely on board with, and is not limited to linear algebra libraries. HTTP client libraries are worse, there's not a single good one.