[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [Help-gsl] Matrix views and column swapping

**From**: |
Michael Braun |

**Subject**: |
[Help-gsl] Matrix views and column swapping |

**Date**: |
Tue, 22 Jan 2008 20:32:24 -0500 |

Hi. I have a strange problem that is causing a segfault, and I have a
theory about the cause. Hopefully someone on this list can confirm/disprove
this theory.
I have a matrix A, and a view V on a submatrix of A. I then swap two
columns of A. Later, I copy another submatrix B into V (and, in turn,
changing values in A). Is V a view on the same column indices of A as
before? Is it possible that copying B into V after the swap in A is causing
some kind of memory problem?
To give you an idea of the kind of thing I am talking about, consider the
following code (where X is a previously defined 3x3 matrix):
gsl_matrix * A = gsl_matrix_alloc(3,5);
gsl_matrix_view V = gsl_matrix_submatrix(A,0,0,3,3);
gsl_matrix_swap_columns(A, 1, 4);
gsl_matrix_memcpy(&V.matrix, X);
Thanks for your help.
Michael
Michael Braun
Assistant Professor of Marketing
MIT Sloan School of Management
One Amherst St., E40-169
Cambridge, MA 02142
(617) 253-3436
address@hidden

**[Help-gsl] Matrix views and column swapping**,
*Michael Braun* **<=**