Problem with the function pdlacpy/MKL.

closed account (GbX4GNh0)
Hello!

I have a matrix
A =| 0 1 2 |
|3 4 5 |
| 6 7 8|

and I want to copy the first two columns to another matrix B like this
B =| * 0 1|
|* 3 4|
| * 7 8 |



I tried to do that using the library pdlacpy ( http://software.intel.com/sites/products/documentation/hpc/mkl/mklman/GUID-6668F062-6C50-4AA3-ADC0-2C66D8EDD9BC.htm) but the code does not run. I think that I didn't define correctly the parameters descea, desceb ( which I don't understand ).

The code is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>              /* I/O lib         ISOC  */
#include <stdlib.h>             /* Standard Lib    ISOC  */
#include <mkl.h>
#include "mkl_scalapack.h"

int main()
{	
double A[9]={0, 1,2,3,4,5,6,7,8};
	double B[9];
	
	int m=3, n=2, d=1;
		char *uplo = "All";

	pdlacpy(uplo, &m, &n, A, 0, 0, &n, B, 0, &d, &n);

	for(i=0; i<3; i++){
		for(j=0; j<3; j++){
			printf("%lf \t", B[i*3+j]);
		}
			printf("\n");
}

Please I would like to ask if you could help me with this.
Thank you very much.
Last edited on
Read the source, it describes the parameters:
http://www.netlib.org/scalapack/explore-html/da/dc2/pdlacpy_8f_source.html

Also why scala? How are you sure scala code will work in c? Are you using an emulator of some sort to run this?
Topic archived. No new replies allowed.