News for hackers. Stuff that matters.
Re:Fortran 2023 by adrian_b on Wednesday November 22, 2023 @11:31AM (#38381380)
C and C++ and most modern programming languages have very poor support for arrays in comparison even with the ancient versions of Fortran, especially for multi-dimensional arrays.

In C++ it is possible to define adequate types and operations for good support of multi-dimensional arrays, but this means that a user must choose some additional libraries to get the support that does not exist in the base language, unlike with Fortran.

C++ can be much better than Fortran for scientific computing, but only after a significant initial effort of establishing a well-specified programming style, based on selecting an appropriate non-obsolete subset of C++ and after selecting carefully a set of libraries that provide all the missing features.

For someone whose main job is not programming, using Fortran can be simpler.

Re:Fortran 2023 by waynecochran on Wednesday November 22, 2023 @01:02PM (#38382668)
C++ Eigen has become the defacto replacement for arrays for matrices and vectors. I am thinking this should make it more competitive w fortran in this domain.
Re:Fortran 2023 by sampo on Wednesday November 22, 2023 @11:06PM (#38389138)
Pick out the even (i,j where both even) elements from a matrix

    m[0::2, 0::2]                        // Numpy
    m(0::2, 0::2)                        // Fortran [1]
    m(seq(0, last, 2), seq(0, last, 2))  // C++ Eigen
[1] If you have declared the array to start indexing from 0.