help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Wrong result in vector from gsl_vector_alloc_col_from_mat


From: Stephan Petzchen
Subject: Re: [Help-gsl] Wrong result in vector from gsl_vector_alloc_col_from_matrix
Date: Wed, 14 Nov 2012 07:57:24 +0100

Sorry, a typo....in output

GSL gives:

/// x x x x 1 1 1
/// 2 x x x x x x
/// x x x x x x x
/// x x x x x x x



On Wed, Nov 14, 2012 at 7:50 AM, Stephan Petzchen <
address@hidden> wrote:

> Hi Peter,
>
> thanks for your reply.
>
>
>
> Here is my code:
>
> uint coffset=4;
>
> /// 1 1 1 1 1 1 1
> /// 2 2 2 2 2 2 2
> /// 3 3 3 3 3 3 3
> /// 4 4 4 4 4 4 4
> gsl_matrix* m=gsl_matrix_calloc(4,7);
>
> for(int i=0;i < m->rows; i++)
> for(int j=0;j < m->columns; j++)
>  m->data[i * m->tda + j]=i+1;
>
> //Expected:
> /// x x x x 1 x x
> /// x x x x 2 x x
> /// x x x x 3 x x
> /// x x x x 3 x x
> gsl_vector* v = gsl_vector_alloc_col_from_matrix(m,coffset);
>
> /// But GSL gives:
> /// x x x x 1 1 1
> /// 1 x x x x x x
> /// x x x x x x x
> /// x x x x x x x
> for(int i=0;i < v->size; i++)
> Assert.AreEqual(m->data[i * m->tda + coffset],v->data[i]);
>  gsl_vector_free(v);
> gsl_matrix_free(m);
>
> Same issue with: gsl_matrix_column, gsl_matrix_diagonal, so probably my
> expectation and/or understanding is wrong.
>
> I appreciate your reply.
>
> best,
> Stephan
>
> On Wed, Nov 14, 2012 at 7:16 AM, Peter Johansson <address@hidden>wrote:
>
>> On 11/14/2012 03:41 AM, Stephan Petzchen wrote:
>>
>>> Hi,
>>>
>>> I am working on the 1.15 version of GSL and get a wrong result in vector
>>> v
>>> from gsl_vector_alloc_col_from_**matrix.  (matrix/gsl_vector_double.h,
>>> matrix/getset_source.c)
>>>
>>> My understanding is that it should return the matrix column data for a
>>> specified column. So, with gsl_vector_alloc_row_from_**matrix, here the
>>> specified row will be returned.
>>>
>>> Example:
>>>
>>> Matrix:
>>> 1 1 1 1 1 1 1
>>> 2 2 2 2 2 2 2
>>> 3 3 3 3 3 3 3
>>> 4 4 4 4 4 4 4
>>>
>>> Expected result for column offset 4 with vector size 4 (specified by no.
>>> of
>>> matrix rows): 1 2 3 4
>>> x x x x 1 x x
>>> x x x x 2 x x
>>> x x x x 3 x x
>>> x x x x 4 x x
>>>
>>> Actual result:
>>> x x x x 1 1 1
>>> 2 x x x x x x
>>> x x x x x x x
>>> x x x x x x x
>>>
>>>  I can not reproduce this. It would help if you please could post your
>> code, output, and expected output.
>>
>> Cheers,
>> Peter
>>
>
>
>


-- 

Gesius GmbH
Beim Strohhause 31
20097 Hamburg, Germany
Tel.    +49 (40) 6094673-10
Mobil +49 (172) 1977014
Fax   +49 (40) 6094673-99
email: address@hidden <address@hidden>
www.gesius.de <http://gesius.de>

gesius. engineering excellence

Sitz der Gesellschaft/Registered office: Hamburg

Handelsregister/Commercial register:  HRB 117558

Geschäftsführung/executive board: Stephan Petzchen

---
This communication contains confidential information. If you are not the
intended recipient please return this email to the sender and delete it
from your records.
Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der
beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den
Absender zurück und löschen Sie die E-mail aus Ihrem System.


reply via email to

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