[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] strange 'data' pointers using more than one submatrix simulta
From: |
Matthias Sitte |
Subject: |
[Help-gsl] strange 'data' pointers using more than one submatrix simultaneously |
Date: |
Thu, 04 Dec 2014 11:27:17 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
Hi,
I've got mixed results on different platforms when using more than one
submatrix simultaneously.
Setup (code is attached):
Create two 2N-by-2N matrices A and B whose elements are given by:
A(i,j) = i*N + j
B(i,j) = i + j*N
Suppose we want to operate on A_ul and B_lr, the upper-left N-by-N
submatrix of A and the lower-right N-by-N submatrix of B, respectively,
and suppose we want to use submatrices instead of writing some loop-like
code.
On one machine (CentOS 6) I get the following:
=== BEGIN ===
address@hidden gsl-matrix-view-test]$ gcc gsl-matrix-view-test.c
-I /u7/matthias/opt/include -L /u7/matthias/opt/lib -lgsl -lgslcblas
address@hidden gsl-matrix-view-test]$ ldd a.out
linux-vdso.so.1 => (0x00007fff8799b000)
libgsl.so.0 => /u7/matthias/opt/lib/libgsl.so.0 (0x00007f00c2810000)
libgslcblas.so.0 => /u7/matthias/opt/lib/libgslcblas.so.0
(0x00007f00c25d6000)
libc.so.6 => /lib64/libc.so.6 (0x000000309d600000)
libm.so.6 => /lib64/libm.so.6 (0x000000309da00000)
/lib64/ld-linux-x86-64.so.2 (0x000000309d200000)
address@hidden gsl-matrix-view-test]$ ./a.out
GSL version: 1.16
A = 0x17c6010
A->data = 0x17c6070
A->nrows = 40
A->ncols = 40
B = 0x17c9280
B->data = 0x17c92e0
B->nrows = 40
B->ncols = 40
A_ul = 0x7fffdb7bad70
A_ul->data = 0x17cac80
A_ul->nrows = 20
A_ul->ncols = 20
B_lr = 0x7fffdb7bad70
B_lr->data = 0x17cac80
B_lr->nrows = 20
B_lr->ncols = 20
=== END ===
So, the 'data' pointer of both A_ul and B_lr are the same??
If I run the same code on a Mac, I get something different:
=== BEGIN ===
wireless-10-145-113-144:gsl-matrix-view-test matthias$ gcc -lgsl
-lgslcblas gsl-matrix-view-test.c -I /opt/local/include/ -L /opt/local/lib
wireless-10-145-113-144:gsl-matrix-view-test matthias$ otool -L a.out
a.out:
/opt/local/lib/libgsl.0.dylib (compatibility version 18.0.0, current
version 18.0.0)
/opt/local/lib/libgslcblas.0.dylib (compatibility version 1.0.0,
current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 1213.0.0)
wireless-10-145-113-144:gsl-matrix-view-test matthias$ ./a.out
GSL version: 1.16
A = 0x7fb6ca404b80
A->data = 0x7fb6ca803200
A->nrows = 40
A->ncols = 40
B = 0x7fb6ca404bc0
B->data = 0x7fb6ca806400
B->nrows = 40
B->ncols = 40
A_ul = 0x7fff5d212ad0
A_ul->data = 0x7fb6ca803200
A_ul->nrows = 20
A_ul->ncols = 20
B_lr = 0x7fff5d212aa0
B_lr->data = 0x7fb6ca807da0
B_lr->nrows = 20
B_lr->ncols = 20
=== END ===
So, here the 'data' pointer is correct and differs for both submatrices.
I'm really puzzled... Any ideas what might be going on here??
MS
--
Dr. Matthias Sitte
The University of Texas at Austin
Department of Physics
2515 Speedway, C1600
Austin, TX 78712-1192
gsl-matrix-view-test.c
Description: Text Data
guysborough.txt
Description: Text document
mac.txt
Description: Text document
- [Help-gsl] strange 'data' pointers using more than one submatrix simultaneously,
Matthias Sitte <=