ScaLAPACK Archives

[Scalapack] ScaLAPACK questions regarding p[sdcz]gels.f


------------------------------------------------------------------------
r70 | langou | 2009-12-17 10:48:44 -0700 (Thu, 17 Dec 2009) | 50 lines
------------------------------------------------------------------------

Modifications suggested with conversation with Jill Reese from MathWorks.

In the LS drivers (PxGELS), the line 280

          CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )

works (i.e. check is always happy in correct conditions of use). However 
the check can be made more rigorous with the following lines:

          IF ( M .GE. N ) THEN
             CALL CHK1MAT( M, 2, NRHS, 4, IB, JB, DESCB, 12, INFO )
          ELSE
             CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )
          ENDIF

Some explanations:

(1) In PxGELS the number of rows of B used by the routine is MAX( M, N ).
Therefore DESCB( M_ ) has better be greater than MAX( M+(IB-1), (N+IB-1)).
(IB is the (global) offset where we want PxGELS to start working.)

(2) CHK1MAT( N, x, x, x, IB, x, DESCB, x, x ) checks that (among other 
checks)

          ( ( 0 .GE. N ) .AND.  ( N + IB - 1 .LE. DESCB( M_ ) ) ),

is true. That is the N given by the user is nonnegative and that N+IB-1 
does
not run out of the bound of the input matrix B.

(3) The CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO ) checks that

          ( ( 0 .GE. N ) .AND.  ( N + IB - 1 .LE. DESCB( M_ ) ) ),

this needs to be correct!

(4) But actually what needs to be correct is

          ( ( 0 .GE. N ) .AND.  ( N + IB - 1 .LE. DESCB( M_ ) ) .AND. ( M + IB 
- 1 .LE. DESCB( M_ ) ) )

One way to achieve this is to write

          IF ( M .GE. N ) THEN
             CALL CHK1MAT( M, 2, NRHS, 4, IB, JB, DESCB, 12, INFO )
          ELSE
             CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )
          ENDIF

which makes sense when reading the PxGELS routine from A to Z.

------------------------------------------------------------------------

===================================================================
Index: scalapack/trunk/SRC/pcgels.f
===================================================================
--- scalapack/trunk/SRC/pcgels.f        (revision 69)
+++ scalapack/trunk/SRC/pcgels.f        (revision 70)
@@ -280,7 +280,11 @@
           INFO = -( 800 + CTXT_ )
        ELSE
           CALL CHK1MAT( M, 2, N, 3, IA, JA, DESCA, 8, INFO )
-         CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         IF ( M .GE. N ) THEN
+            CALL CHK1MAT( M, 2, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         ELSE
+            CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         ENDIF
           IF( INFO.EQ.0 ) THEN
              IROFFA = MOD( IA-1, DESCA( MB_ ) )
              ICOFFA = MOD( JA-1, DESCA( NB_ ) )
Index: scalapack/trunk/SRC/psgels.f
===================================================================
--- scalapack/trunk/SRC/psgels.f        (revision 69)
+++ scalapack/trunk/SRC/psgels.f        (revision 70)
@@ -277,7 +277,11 @@
           INFO = -( 800 + CTXT_ )
        ELSE
           CALL CHK1MAT( M, 2, N, 3, IA, JA, DESCA, 8, INFO )
-         CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         IF ( M .GE. N ) THEN
+            CALL CHK1MAT( M, 2, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         ELSE
+            CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         ENDIF
           IF( INFO.EQ.0 ) THEN
              IROFFA = MOD( IA-1, DESCA( MB_ ) )
              ICOFFA = MOD( JA-1, DESCA( NB_ ) )
Index: scalapack/trunk/SRC/pdgels.f
===================================================================
--- scalapack/trunk/SRC/pdgels.f        (revision 69)
+++ scalapack/trunk/SRC/pdgels.f        (revision 70)
@@ -277,7 +277,11 @@
           INFO = -( 800 + CTXT_ )
        ELSE
           CALL CHK1MAT( M, 2, N, 3, IA, JA, DESCA, 8, INFO )
-         CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         IF ( M .GE. N ) THEN
+            CALL CHK1MAT( M, 2, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         ELSE
+            CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         ENDIF
           IF( INFO.EQ.0 ) THEN
              IROFFA = MOD( IA-1, DESCA( MB_ ) )
              ICOFFA = MOD( JA-1, DESCA( NB_ ) )
Index: scalapack/trunk/SRC/pzgels.f
===================================================================
--- scalapack/trunk/SRC/pzgels.f        (revision 69)
+++ scalapack/trunk/SRC/pzgels.f        (revision 70)
@@ -280,7 +280,11 @@
           INFO = -( 800 + CTXT_ )
        ELSE
           CALL CHK1MAT( M, 2, N, 3, IA, JA, DESCA, 8, INFO )
-         CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         IF ( M .GE. N ) THEN
+            CALL CHK1MAT( M, 2, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         ELSE
+            CALL CHK1MAT( N, 3, NRHS, 4, IB, JB, DESCB, 12, INFO )
+         ENDIF
           IF( INFO.EQ.0 ) THEN
              IROFFA = MOD( IA-1, DESCA( MB_ ) )
              ICOFFA = MOD( JA-1, DESCA( NB_ ) )
===================================================================


<Prev in Thread] Current Thread [Next in Thread>
  • [Scalapack] ScaLAPACK questions regarding p[sdcz]gels.f, Julien Langou <=


For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or