The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

About Example1

Open discussion regarding features, bugs, issues, vendors, etc.

About Example1

Postby arad » Sat May 10, 2008 1:09 pm

Testing the solution that example1 gives i called the returned B vector after the call of PDGESV with the following

WRITE(*,*) 'FOR PROCESSOR ',MYROW,' - ',MYCOL,' THEN
$ X = ',B(1:5,1)

and i got the results

FOR PROCESSOR 0 - 0 THEN
X = -1.460819769243627E-18 -0.16666666666667 0.0 1.734723475976807E-18 0.0

FOR PROCESSOR 0 - 1 THEN X = 0.0 0.0 0.0 0.0 0.0
FOR PROCESSOR 1 - 0 THEN X = 0.5 0.0 -0.5 0.166666666666667 0.0
FOR PROCESSOR 0 - 2 THEN X = 0.0 0.0 0.0 0.0 0.0
FOR PROCESSOR 1 - 1 THEN X = 0.0 0.0 0.0 0.0 0.0
FOR PROCESSOR 1 - 2 THEN X = 0.0 0.0 0.0 0.0 0.0


while the solution is supposed to be
(0, -1/6 , 1/2 , 0 , 0 , 0, -1/2 , 1/6 , 0)

(according to the Manual)

some arguements are correct but some others not..

THE SOLUTION THAT MY PROGRAM GIVES WITH QR IS

FOR PROCESSOR 0 - 0 THEN C = 4.869399230812091E-19 -0.16666666666667 -2.152740323804712E-16 1.061894218528006E-17 -8.364977976252789E-18
FOR PROCESSOR 0 - 1 THEN C = 0.0 0.0 0.0 0.0 0.0
FOR PROCESSOR 1 - 0 THEN C = 0.5 9.136793561514366E-18 -0.5 0.166666666666667 0.0
FOR PROCESSOR 0 - 2 THEN C = 0.0 0.0 0.0 0.0 0.0
FOR PROCESSOR 1 - 2 THEN C = 0.0 0.0 0.0 0.0 0.0
FOR PROCESSOR 1 - 1 THEN C = 0.0 0.0 0.0 0.0 0.0

I think that these E-18 E-30 etc are actually zeros, am i right ?
Last edited by arad on Sat May 10, 2008 1:39 pm, edited 2 times in total.
arad
 
Posts: 17
Joined: Wed Apr 16, 2008 4:12 pm

Postby arad » Sat May 10, 2008 1:22 pm

ok i think i got it.. so my program is CORRECT !!!!

but i have one question on example 1...

why on processor (1,0) the example1 sets the second row as (-c,-c,-c,c) while it is supposed to be (-c,-c,-c,-c) ???? (the last arguement is supposed to be -c because it is considered to be the element (8,2) from the 9x9 global array A of the example right ??)
from example1

ELSE IF( MYROW.EQ.1 .AND. MYCOL.EQ.0 ) THEN
AA( 1 ) = -S
AA( 2 ) = -S
AA( 3 ) = -S
AA( 4 ) = -S
AA( 1+MXLLDA ) = -C
AA( 2+MXLLDA ) = -C
AA( 3+MXLLDA ) = -C
AA( 4+MXLLDA ) = C
AA( 1+2*MXLLDA ) = A
AA( 2+2*MXLLDA ) = A
AA( 3+2*MXLLDA ) = A
AA( 4+2*MXLLDA ) = -A
AA( 1+3*MXLLDA ) = C
AA( 2+3*MXLLDA ) = C
AA( 3+3*MXLLDA ) = C
AA( 4+3*MXLLDA ) = C
B( 1 ) = 1.0D0
B( 2 ) = 0.0D0
B( 3 ) = 0.0D0
B( 4 ) = 0.0D0
arad
 
Posts: 17
Joined: Wed Apr 16, 2008 4:12 pm

Postby Julien Langou » Sat May 10, 2008 6:57 pm

Yes you are entirely correct, there is a weird accumulation of typos in
the ScaLAPACK example1.f (see [1,2]) in the ScaLAPACK Users' Guide
Section Getting Started with ScaLAPACK (see [3]). I have never
understood where this was coming from.
    Either you change the matrix from the example and you take
    Code: Select all
     s  c  a  l  a  p  a  c  k
    -s  c  a  l  a  p  a  c  k
    -s -c  a  l  a  p  a  c  k
    -s -c -a  l  a  p  a  c  k
    -s -c -a -l  a  p  a  c  k
    -s -c -a -l -a  p  a  c  k
    -s -c -a -l -a -p  a  c  k
    -s +c -a -l -a -p -a  c  k
    -s -c -a -l -a -p -a -c  k

    Note the +c in position (8,2). Then [1,2,3] are correct up to this typo:
    • the block owned by processor (1,0) is
      Code: Select all
      -s -c  a  c
      -s -c  a  c
      -s -c  a  c
      -s +c -a  c

      as mentionned in [3] and done in exampe1.f [1,2].
    • the solution vector is
      Code: Select all
      ( x1 )   (   0  )
      ( x2 )   ( -1/6 )
      ( x3 )   (  1/2 )
      ( x4 )   (   0  )
      ( x5 ) = (   0  )
      ( x6 )   (   0  )
      ( x7 )   ( -1/6 )
      ( x8 )   (  1/2 )
      ( x9 )   (   0  )

      and is distributed as
      Code: Select all
      proc(0,0)                       proc(1,0)
      (x1)    ( b1 )   (   0  )       (x3)    ( b1 )   (  1/2 )
      (x2)    ( b2 )   ( -1/6 )       (x4)    ( b2 )   (   0  )
      (x5)    ( b3 ) = (   0  )       (x7)    ( b3 ) = ( -1/2 )
      (x6)    ( b4 )   (   0  )       (x8)    ( b4 )   (  1/6 )
      (x9)    ( b5 )   (   0  )

      as mentioned on [3].
    That's an easy fix, but the matrix looks ugly.
  • or you keep the matrix from the example:
    Code: Select all
     s  c  a  l  a  p  a  c  k
    -s  c  a  l  a  p  a  c  k
    -s -c  a  l  a  p  a  c  k
    -s -c -a  l  a  p  a  c  k
    -s -c -a -l  a  p  a  c  k
    -s -c -a -l -a  p  a  c  k
    -s -c -a -l -a -p  a  c  k
    -s -c -a -l -a -p -a  c  k
    -s -c -a -l -a -p -a -c  k

    Then [1,2,3]:
    • the block owned by processor (1,0) is
      Code: Select all
      -s -c  a  c
      -s -c  a  c
      -s -c  a  c
      -s -c -a  c

      so code example1.f needs to amended [1,2] and [3] needs to be
      modified.
    • the solution vector is
      Code: Select all
      ( x1 )   (   0  )
      ( x2 )   ( -1/6 )
      ( x3 )   (  1/2 )
      ( x4 )   (   0  )
      ( x5 ) = (   0  )
      ( x6 )   (   0  )
      ( x7 )   (   0  )
      ( x8 )   (   0  )
      ( x9 )   (   0  )

      and is distributed as
      Code: Select all
      proc(0,0)                       proc(1,0)
      (x1)    ( b1 )   (   0  )       (x3)    ( b1 )   (  1/2 )
      (x2)    ( b2 )   ( -1/6 )       (x4)    ( b2 )   (   0  )
      (x5)    ( b3 ) = (   0  )       (x7)    ( b3 ) = (   0  )
      (x6)    ( b4 )   (   0  )       (x8)    ( b4 )   (   0  )
      (x9)    ( b5 )   (   0  )

      so [3] needs to be corrected.

Either way.
(We never found the time to correct these mistakes.)

--julien

[1] ScaLAPACK example1.f,
http://www.netlib.org/scalapack/examples/example1.f.
[2] ScaLAPACK Users' Guide Section: Source Code for Example
Program #1
,
http://www.netlib.org/scalapack/slug/node27.html.
[3] ScaLAPACK Users' Guide Section: Details of Example Program #1,
http://www.netlib.org/scalapack/slug/node28.html.

NB: when you print your vector on each processor, be sure not to exceed
the vector size. In your case, the local size of the vector X on proc (0,0) is
5, while the local size of the vector X on proc(1,0) is 4 and while on proc
(1,0), (1,1), (2,0) and (2,1) there is no vector X at all.
Julien Langou
 
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 6 guests