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 Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
- dgelss will output incorrect result when matrix = [100, 3]

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

Highlighted
##

Hai

Beginner

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

02-03-2013
02:15 PM

10 Views

dgelss will output incorrect result when matrix = [100, 3]

Hi,

I am using dgelss to simulate same result as pinv() in Matlab. When I set matrix to be [10, 3], the result is correct. But when I change the matrix size to be [100, 3], then the outcome will become a matrix with most elements to be 0.

Any input will be welcome.

Thanks

Hai

6 Replies

Highlighted
##

Chao_Y_Intel

Employee

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

02-03-2013
11:22 PM

10 Views

Hai,

Do you have a test code that could show this problem?

Regards,

Chao

Highlighted
##

Hai

Beginner

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

02-14-2013
08:38 AM

10 Views

Did someone else have similar problem?

Highlighted
##

mecej4

Black Belt

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

02-17-2013
07:05 AM

10 Views

Did someone else have similar problem?

Merely asking that question, instead of describing your problem in sufficient detail, is not likely to lead to answers.

Here is an example that shows GELSS working correctly for a 100 X 3 matrix. Therefore, the MKL implementation of GELSS works for some inputs. If you have an input for which it fails to give correct results, please publish the example. [fortran] program gelss_example USE MKL95_LAPACK, ONLY: GELSS !DEC$ OBJCOMMENT lib:'mkl_lapack95' implicit none integer, parameter :: dp=kind(1d0) integer, parameter :: M=100,N=3 integer :: i,j,k real(dp) :: A(M,N),x(N),B(M),delta(M) ! ! create test problem ! call RANDOM_NUMBER(A); call RANDOM_NUMBER(delta) x(1)=2.718; x(2)=3.1425; x(3)=0.1729 A=(2*A-1)*10 ! random numbers between -10 and +10 B=MATMUL(A,x)+(2*delta-1)*0.01 ! call GELSS(A,B) write(*,10)x,B(1:N) 10 format(' Original x used to create B: ',3F8.5,/, & ' GELSS results for x : ',3F8.5) end program gelss_example [/fortran]

Compiling and running on Windows using

[bash] ifort /Qmkl xgelss.f90[/bash]

I get the output

[bash] Original x used to create B: 2.71800 3.14250 0.17290 GELSS results for x : 2.71796 3.14250 0.17291 [/bash]

Highlighted
##

Hai

Beginner

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

02-20-2013
01:31 PM

10 Views

I already sent my code to Chao Y who help me provided a temporary solution which can calculate dgelss correctly for a 100x3 matrix.

I am not sure how Fortran code works. But my code works fine for a matrix with size 10x3. But when I change the matrix size to 100x3 or larger, the results will be almost zeros.

Thanks for your input.

Highlighted
##

Chao_Y_Intel

Employee

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

02-20-2013
06:35 PM

10 Views

Thanks, Hai for the code. yes, we could verify this is a bug, and will fix it in the future release soon. I am also checking if there is any workaound for this problem.

Regards,

Chao

Highlighted
##

Sergey_K_Intel1

Employee

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

03-05-2013
02:00 AM

10 Views

Dear Hai,

The problem comes from your code. Your reproducer has internal error: lwork query was done for the parameters differs from those of the second call of functionality.

According to the MKL Reference Guide the size of work array for dgelss depends on the first three input parameters. You call dgelss for determining the size of workspace for the set (m, n, n)

dgelss(&m, &n, &n ...

where m=100 and n=3. Meanwhile the second call is for another set of parameters (m, n, m)

dgelss(&m, &n, &m, ..

BUT the values of these parameters must be identical for both calls.

All the best

Sergey

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