bug-gsl
[Top][All Lists]
Advanced

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

Re: [Bug-gsl] Documentation: gsl_spmatrix_alloc_nzmax does not necessari


From: Patrick Alken
Subject: Re: [Bug-gsl] Documentation: gsl_spmatrix_alloc_nzmax does not necessarily initialize to all-zeros
Date: Sat, 11 Feb 2017 07:59:52 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

Hello,

  Thanks for the report. I think the best fix is to check for nz == 0 in
gsl_spmatrix_get rather than setting p to 0 in the alloc function. I
made this change on the git, and also added a test for this in the
future. The issue should be fixed - let me know if you have any further
problems.

Thanks,
Patrick

On 01/19/2017 09:39 AM, Schmitz Manuel (LBC) wrote:
> The GSL documentation says in chapter 41.2 about function 
> "gsl_spmatrix_alloc_nzmax":
> "This function allocates a sparse matrix of size n1-by-n2 and initializes it 
> to all zeros."
>
> However, in the case of the CCS or the CRS storage format, the member "p" is 
> not initialized. Calling "gsl_spmatrix_get"  on a freshly allocated matrix 
> may yield a nonzero value, because its "p" member may contain offsets to an 
> unspecified location in memory.
> (Remark: The function gsl_spmatrix_get does not check against the "nz" 
> property of the matrix.)
>
> I have attached a modified version of the spmatrix.c file, which does 
> initialize the "p" vector when creating a matrix in CCS or CRS storage 
> format. But, I would prefer to adjust the documentation rather than the code, 
> because a zero-initialized matrix is not always necessary.
>
> Best regards
>
> i.A. Manuel Schmitz
>
> TB-Berechnung
>
> Liebherr-Werk Biberach GmbH
> PO Box 16 63
> 88396 Biberach an der Riss
> Germany
> Phone: +49 (7351) 414639
> address@hidden<mailto:address@hidden>
> www.liebherr.com<http://www.liebherr.com>
>
> Chairman of the supervisory board: Stefan Heissler
> Managing directors: Dipl.-Betriebsw.(BA) Hubert Deutsch, Dipl.-Ing. Marco 
> Guariglia, Dipl.-Ing. Günther Hardock, Dipl.-Ing. Dominique Tasch
> Registered business address: 88400 Biberach an der Riss, Memminger Straße 120
> Court of jurisdiction: Amtsgericht Ulm HRB 640075, USt-Id Nr. DE811120028
>
> This email may contain confidential and/or privileged information. If you are 
> not the intended recipient (or have received this email in error) please 
> notify the sender immediately and destroy this email. Any unauthorized 
> copying, disclosure or distribution of the material in this email is strictly 
> forbidden.





reply via email to

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