Many of the linear algebra decompositions need to operate on submatrices of the 
original matrix so it wouldn't make sense to allocate a new matrix.

To do what you want, you can allocate a new matrix and call gsl_matrix_memcpy

On Dec 5, 2014 11:26 PM, Matthias Sitte <[email protected]> wrote:
>
> Forgot to CC the list... 
>
> An implementation-related questions: Why does gsl_matrix_submatrix() 
> return a view of a matrix on the stack (which just wraps the underlying 
> gsl_matrix struct) and not a pointer to a newly created gsl_matrix 
> struct (which I would have to free manually, but I have to free most of 
> GSL's structs by hand anyway)??? 
>
> If there is no quick answer, that's fine, I was just wondering... 
>
>   Matthias 
>
>
> -------- Forwarded Message -------- 
> Subject: Re: [Help-gsl] strange 'data' pointers using more than one 
> submatrix simultaneously 
> Date: Sat, 6 Dec 2014 00:28:28 +0100 
> From: Frank Reininghaus <[email protected]> 
> To: Matthias Sitte <[email protected]> 
>
> Hi, 
>
> 2014-12-05 17:38 GMT+01:00 Matthias Sitte <[email protected]>: 
> > Oh my ... I totally missed that. Corrected that and it works! :D 
> > 
> > An implementation-related questions: Why does gsl_matrix_submatrix() return 
> > a view of a matrix on the stack (which just wraps the underlying gsl_matrix 
> > struct) and not a pointer to a newly created gsl_matrix struct (which I 
> > would have to free manually, but I have to free most of GSL's structs by 
> > hand anyway)??? Just wondering ... 
>
> I have no time to look into that right now. Please always include the 
> mailing list in your replies - that makes it much more likely that 
> anyone will answer your question soon. 
>
> Regards, 
> Frank 
>
>

Reply via email to