Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- Least squares, QR and pivoting

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

italo1337

Beginner

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

05-12-2011
11:23 PM

48 Views

Least squares, QR and pivoting

[cpp]#includeThe result is correct, but sometimes in wrong order. Am I doing anything wrong when mapping the result?#include "mkl_lapacke.h" #include "mkl_cblas.h" #include "mkl_types.h" #include "least_squares.h" void solve_least_squares(double *A, double *b, double *result, int m, int n) { int i; int *jpvt = calloc(n, sizeof(int)); double *tau = calloc(n, sizeof(double)); LAPACKE_dgeqp3(LAPACK_ROW_MAJOR, m, n, A, n, jpvt, tau); LAPACKE_dormqr(LAPACK_ROW_MAJOR, 'L', 'T', m, 1, n, A, n, tau, b, 1); cblas_dtrsm(CblasRowMajor, CblasLeft, CblasUpper, CblasNoTrans, CblasNonUnit, n, 1, 1.0, A, n, b, 1); for ( i = 0 ; i < n ; i++ ) { result = b[jpvt-1]; } free(jpvt); free(tau); } [/cpp]

It is related to pivoting. When I add to the beggining of the function:

[cpp] for ( i = 0 ; i < n ; i++ ) { jpvtThis prevents pivoting and yields the correct result in the correct order.= i+1; } [/cpp]

Link Copied

1 Reply

mecej4

Black Belt

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

05-13-2011
03:28 AM

48 Views

f08bffe.f

In particular, see how the permutation is undone for the solution in the DO 100 loop. More generally, undoing a sequence of permutations requires that the individual permutations be undone in

Topic Options

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

For more complete information about compiler optimizations, see our Optimization Notice.