- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Could someone kindly give me an example for C++ which uses MKL library for calculating the inverse of a square matrix. I would like to extend that to find the inverse of a square matrix which is fully populated and low dimensions (at most 2020).

Thanks,

Ahmad

Link Copied

2 Replies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

**dgetrf**and

**dgetri**are not fast. I compared the speed for calculating the inverse of 1010 fully populated matrix with MATLAB and there was order of magnitude difference. Is there a faster function than

**dgetri**?

Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

How fast do you want it to be? By my measurement DGETRF + DGETRI takes just 1.8ms:

$ cat test.f90 program test double precision a(10, 10), work(10) integer ipiv(10), info integer t1, t2, r call random_number(a) call system_clock(count=t1) call dgetrf(10, 10, a, 10, ipiv, info) call dgetri(10, a, 10, ipiv, work, 10, info) call system_clock(count=t2, count_rate=r) print *, (t2 - t1) / sngl end program $ ifort test.f90 -otest -mkl=sequential $ time ./test 1.8000000E-03 $

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page