Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Georgios_S_
New Contributor II
199 Views

dpotrf arguments

Jump to solution

With the help of this great forum and old post, I was able to finally execute my first example on Cholesky factorization. However, I have a question. I call the function like this:

  dpotrf(
        &'L',
        &N, // A is NxN matrix
        A,
        &N,
        &nInfo
  );

Since I am planning to do a distributed factorization, I have to be sure about the arguments. What is the latter 'N' used for? My first thought was about the dimension of the output, but that's the same array, so I am confused.

 

Moreover, the documentation gives this prototype

void pdpotrf (char *uplo , MKL_INT *n , double *a , MKL_INT *ia , MKL_INT *ja , MKL_INT *desca , MKL_INT *info );

In my example, the arguments are less than what the prototype has. Why there are more arguments there?

Finally, I do not understand ia, ja and desca arguments. Come someone explain to a student like me their use?

0 Kudos
1 Solution
mecej4
Black Belt
199 Views

Think about how one maps the two subscripts of a matrix element to a single offset into memory, and note that often (especially in F77 and earlier, which did not have ALLOCATE) the declared size of an array can be larger than the actual size used in a specific part of the program. To do the mapping, the leading dimension (i.e., the declared column size in Fortran) needs to be known, because most array arguments are passed in F77 and earlier as just the base address of the array, with no additional information regarding the extents of each subscript.

The argument list that you show is for the special case where the declared array size (the "maximum" size) is the same as the effective size (the size being used in the calculation at the moment), so you see N twice and may find it quixotic. Ask yourself, "how would things be if A was declared larger than N X N?".

The routine DPOTRF is in Lapack; PDPOTRF is in Scalapack. They are different routines in different libraries, with similar (but not identical) argument lists and objectives.

DPOTRF (and most Lapack subroutines) work with dense matrices. The routine PDPOTRF is for use with distributed matrices, and the arrays IA, JA, etc. contain details of how the distributed matrix is stored. See, for example, the comments in http://www.netlib.org/scalapack/explore-html/d5/d9e/pdpotrf_8f_source.html .

View solution in original post

4 Replies
mecej4
Black Belt
200 Views

Think about how one maps the two subscripts of a matrix element to a single offset into memory, and note that often (especially in F77 and earlier, which did not have ALLOCATE) the declared size of an array can be larger than the actual size used in a specific part of the program. To do the mapping, the leading dimension (i.e., the declared column size in Fortran) needs to be known, because most array arguments are passed in F77 and earlier as just the base address of the array, with no additional information regarding the extents of each subscript.

The argument list that you show is for the special case where the declared array size (the "maximum" size) is the same as the effective size (the size being used in the calculation at the moment), so you see N twice and may find it quixotic. Ask yourself, "how would things be if A was declared larger than N X N?".

The routine DPOTRF is in Lapack; PDPOTRF is in Scalapack. They are different routines in different libraries, with similar (but not identical) argument lists and objectives.

DPOTRF (and most Lapack subroutines) work with dense matrices. The routine PDPOTRF is for use with distributed matrices, and the arrays IA, JA, etc. contain details of how the distributed matrix is stored. See, for example, the comments in http://www.netlib.org/scalapack/explore-html/d5/d9e/pdpotrf_8f_source.html .

View solution in original post

Georgios_S_
New Contributor II
199 Views

Damn it, I understood that I had made a mistake in the function I used, just after a while I did the post, however, I wasn't able to update. Sorry about that.

About DPOTRF, I found this ref, which states that N is "The order of the matrix A" and LDA is "The leading dimension of the array A". I do not know any Fortran, I have a strong C/C++ background though I still do not understand the difference between this two parameters, maybe because I approach the problem from a C perspective.

About PDPOTRF, which is the one that I want to use, the Fortran documentation seems a bit bizarre for me. Do you have any C example on this?

I only found this SO question, which contains some code, but it does not have any MKL in it!

TimP
Black Belt
199 Views
You could translate the posted source code via f2c if you want to understand from a c viewpoint how the arguments are used. As it relates to a 2d Fortran array, it's not a textbook c construct.
Georgios_S_
New Contributor II
199 Views

I can't understand that " it's not a textbook c construct", sorry.

EDIT:

I found this link, which explains the LDA. So, now, I can assume that by order of Matrix, it needs the number of rows.

Reply