Question on function ZLANHE

Post here if you want to report a bug to the LAPACK team

Question on function ZLANHE

Postby mk0511 » Fri Aug 22, 2014 5:03 am

Hi,

Quick question on the above function; between the line 196 and 204, it looks to me that the workspace has not been initialised to zero before being used. Is this the correct behaviour ?

Regards
MK
mk0511
 
Posts: 1
Joined: Fri Aug 22, 2014 4:54 am

Re: Question on function ZLANHE

Postby akobotov » Mon Jun 29, 2015 8:49 am

LAPACKers,

Please apply the fix from r1474 to ZLANHE and CLANHE as well. This will correct the mentioned issue.
As I see the issue is fixed for ?LANSY on the revision, but the fix is missed for ?LANHE.

Best regards,
Alexander
akobotov
 
Posts: 11
Joined: Wed Feb 03, 2010 7:38 am
Location: Intel Corp., Russia, Novosibirsk

Re: Question on function ZLANHE

Postby Julien Langou » Mon Jun 29, 2015 9:56 am

Hi MK, Hi Alex,

The code reads as
Code: Select all
            DO 60 J = 1, N
               SUM = ZERO
               DO 50 I = 1, J - 1
                  ABSA = ABS( A( I, J ) )
                  SUM = SUM + ABSA
                  WORK( I ) = WORK( I ) + ABSA
   50          CONTINUE
               WORK( J ) = SUM + ABS( DBLE( A( J, J ) ) )
   60       CONTINUE


The outer j-loop runs from 1 to N and initialize WORK(J).
The inner i-loop runs from 1 to J-1 and uses (and updates) WORK(I).
As a consequence, whenever WORK(I) is used, it has already been initialized by the j-loop.

In exit of these two loops, WORK(J) will contain the sum of the absolute value of the column J of A.

At step J, the i-loop accumulated from A(1,J) to A(J-1,J) in SUM, the lines of codes are
Code: Select all
               SUM = ZERO
               DO 50 I = 1, J - 1
                  ABSA = ABS( A( I, J ) )
                  SUM = SUM + ABSA
   50          CONTINUE

then we add A(J,J) as well
Code: Select all
               WORK( J ) = SUM + ABS( DBLE( A( J, J ) ) )

(Note: this initializes WORK( J ).) We are missing A(J+1,J) to A(N,J). We access them in row J with A(J,J+1) to A(J,N) and add them with the i-loop with the line
Code: Select all
                  WORK( I ) = WORK( I ) + ABSA


Cheers,
Julien and Mathieu.
Julien Langou
 
Posts: 747
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Re: Question on function ZLANHE

Postby chereshnev » Tue Jun 30, 2015 4:56 am

Hi,

I found revision with fixes of xlansy routines with the similar fix. But they contains the same loops in the case uplo = "U"
So WORK array has already been initialized without previous loop with zeroing and these changes can be safely reverted.

Revision: 1474
Author: julie
Date: 15 Feb 2014 4:13:20
Message:
Fix potential initiation issue in (c,d,s,z)lansy.f
Bug report sent from Elena Ivanova on Feb 2014

Array WORK is initialized with ZERO when 'L' and is not initialized when 'U'.
There can be some garbage in WORK. Move up the initialization of WORK before the line
IF( LSAME( UPLO, 'U' ) ) THEN.

Rearrange loop ordering numbers.
----
Modified : /lapack/trunk/SRC/clansy.f
Modified : /lapack/trunk/SRC/dlansy.f
Modified : /lapack/trunk/SRC/slansy.f
Modified : /lapack/trunk/SRC/zlansy.f
chereshnev
 
Posts: 3
Joined: Thu Oct 09, 2014 6:17 am
Location: Intel Corp., Russia, Novosibirsk

Re: Question on function ZLANHE

Postby Julien Langou » Tue Jun 30, 2015 7:42 am

Hi Eugene, you are correct. I just reverted to the previous version and consequently removed the changes made in rev 1474. Julien.
Julien Langou
 
Posts: 747
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA


Return to Bug report

Who is online

Users browsing this forum: No registered users and 1 guest