What's a good C++ library for matrix operations

前端 未结 8 1375
温柔的废话
温柔的废话 2021-01-04 09:31

I need to do multiplication on matrices. I\'m looking for a library that can do it fast. I\'m using the Visual C++ 2008 compiler and I have a core i7 860 so if the library i

8条回答
  •  日久生厌
    2021-01-04 10:14

    BLAS is a de facto Fortran standard for all basic linear algebra operations (essentially multiplications of matrices and vectors). There are numerous implementations available. For instance:

    • ATLAS is free and supposedly self-optimizing. You need to compile it yourself though.
    • Goto BLAS is maintained by Kazushige Goto at TACC. He is very good at getting the last performance bit out of modern processors. It is only for academic use though.
    • Intel MKL provides optimised BLAS for Intel processors. It is not free, even for academic use.

    Then, you may want to use a C++ wrapper, for instance boost::ublas.

    If you program on distributed systems, there are PBLAS and ScaLAPACK which enable the use of message passing for distributed linear algebra operations. On a multicore machine, usually implementations of BLAS (at least Intel MKL) use threads for large enough matrices.

    If you want more advanced linear algebra routines (eigenvalues, linear systems, least square, ...), then there is the other de facto Fortran standard LAPACK. To my knowledge, there is nothing to integrate it elegantly with C++ other than calling the bare Fortran routines. You have to write some wrappers to hide the Fortran calls and provide a sound type-checking implementation.

提交回复
热议问题