[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Multiple views on same matrix

From: Brian Gough
Subject: Re: [Help-gsl] Multiple views on same matrix
Date: Wed, 23 Jan 2008 21:53:11 +0000
User-agent: Wanderlust/2.14.0 (Africa) Emacs/22.1 Mule/5.0 (SAKAKI)

At Tue, 22 Jan 2008 23:22:51 -0500,
Michael Braun wrote:
> For example, is this a legal representation:
> gsl_matrix * A  = gsl_matrix_alloc(3,6);
> gsl_matrix_view V1 = gsl_matrix_submatrix(A,0,0,2,6);
> gsl_matrix_view V2 = gsl_matrix_submatrix(A,0,0,2,4); // the views overlap
> gsl_matrix_memcpy(&V1.matrix,X);  / X is a 2x6 matrix
> And then, could I set, get and memcpy to &V1.matrix and &V2.matrix freely?
> Or, once I create V2, does V1 disappear?

There can be multiple views of the same matrix, it is not a problem.

> 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?

Using gsl functions alone should not cause any error, they all verify
that the (sub)matrices are valid when they are called.

To find unexplained segmentation faults:

1. eliminate compiler warnings 

2. try runing the program under "valgrind" (

Brian Gough

reply via email to

[Prev in Thread] Current Thread [Next in Thread]