geqp3 seems do nothing in my self-developed subroutine? urgently need your help

geqp3 seems do nothing in my self-developed subroutine? urgently need your help

I'm writting a subroutine in which the mkl QR factorization subroutine geqp3 is used. However, I find that it seems the geqp3 do nothing! The subroutine is listed below. I don't know what's wrong with my code and urgently need your help. Thanks!

subroutine determine_the_sampled_rows_and_cols(WSS,tempWSS,WTSR,jpvtr,jpvtc,lidf,lids,m,n,num_rank)    

use lapack95    

implicit none     complex(4)  WSS(:,:),tempWSS(:,:),WTSR(:,:)    

integer(4) num_rank,m,n,j,i,lidf(:),lids(:)    

integer(4) jpvtr(:),jpvtc(:)    

real(4) threshold    

complex(4), allocatable::tempWSS1(:,:)    

integer(4), allocatable::jpvtr1(:),jpvtc1(:)

!allocate(tempWSS1(m,n),jpvtr1(m),jpvtc1(n))    

!tempWSS1=WSS     !jpvtc1(1:n)=0    

!call geqp3(tempWSS1,jpvtc1)    

!do j=1,num_rank    

!    do i=1,m    

 !        WTSR(j,i)=WSS(i,jpvtc1(j))    

!    enddo           

 !enddo    

!    

!jpvtr1(1:m)=0    

 !call geqp3(WTSR,jpvtr1)     

 !    

!do i=1,num_rank    

 !    jpvtr(i)=lidf(jpvtr1(i))    

 !    jpvtc(i)=lids(jpvtc1(i))    

 !enddo    

 !    

 !deallocate(tempWSS1,jpvtr1,jpvtc1)                

 tempWSS(1:m,1:n)=WSS(1:m,1:n)    

 jpvtc(1:n)=0    

call geqp3(tempWSS(1:m,1:n),jpvtc(1:n))    

do j=1,num_rank        

 do i=1,m            

 WTSR(j,i)=WSS(i,jpvtc(j))        

enddo           

 enddo        

 jpvtr(1:m)=0    

call geqp3(WTSR,jpvtr)         

 do i=1,num_rank        

 jpvtr(i)=lidf(jpvtr(i))        

jpvtc(i)=lids(jpvtc(i))    

 enddo            

end

 

 

 

 

 

 

 

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
mecej4's picture

How a subprogram functions depends quite a bit on what arguments are passed to it. What arguments did you call the subroutine with when "GEQP3 did nothing" and what basis did you reach that conclusion?

Dear Mecej4,

Thank you very much for your reply! My expression of "do nothing" is not accurate. What I mean is that after "call geqp3(tempWSS(1:m,1:n),jpvtc(1:n))" the elements in jpvtc still are zeros and the values in tempWSS(1:m,1:n) is the same as that before calling this function. The attached is the debug information and the subroutines related to the problem. Please help me check what is the potential problem with my program and also give me some suggestion of my programming style cause I'm relatively new in using Fortran 95.  Thank you very much!

Attachments: 

AttachmentSize
Download debug-infor.docx113.33 KB
mecej4's picture

Your file "debug-infor.docx" does not provide significant new information. In particular, I need to know what the values are of the arguments to geqp3().

Here is a simple example of using geqp3. The output shows that the input arguments were changed (as expected).

program xgeqp3
use mkl95_lapack, only : geqp3
implicit none
real, dimension (3,3) :: A
real :: tau(3)
integer jpiv(3),info,i,j
data A/4.1,1.2,-2.2, -1.9,5.1,3.5, -1.3, -2.4, 7.7/
data jpiv/0,0,0/
call geqp3(A, jpiv, tau, info)
write(*,10)((A(i,j),j=1,3),jpiv(i),tau(i),i=1,3)
10 format(3ES10.2,2x,I2,2x,ES10.2)
end program xgeqp3

>>...subprogram functions depends quite a bit on what arguments are passed to it...

I agree that in your case an incorrect input argument, or a couple of arguments, could be responsible for exit from the function with some error code, like "Invalid input parameter". In all Intel APIs there are verifications of input parameters of functions.

Thank you for your suggestions. I will try the fortran77 subroutine.

Login to leave a comment.