public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* switched sparse format to binary trees
@ 2014-04-28  1:32 Patrick Alken
  2014-04-28 22:35 ` Gerard Jungman
  0 siblings, 1 reply; 16+ messages in thread
From: Patrick Alken @ 2014-04-28  1:32 UTC (permalink / raw)
  To: gsl-discuss

I received a bug report from someone who found that the
gsl_spmatrix_set() function did not properly detect duplicate elements
(ie it could set the same (i,j) matrix element to more than 1 value).

This was related to the linear array scheme I had originally
implemented, which made it very infefficient to find duplicates (ie: a
linear search was required each time).

So I've changed the storage scheme for the triplet representation to a
binary tree (specifically the AVL balanced binary tree). I took code
from the GNU libavl library for the tree manipulation stuff.

This actually makes a huge speed improvement in duplicate detection and
element retrieval for large sparse matrices. There may however be a
performance hit since a new tree node must be allocated each time an
element is added to the matrix. But I believe the tradeoff is worth it.

Anyone using gsl_spmatrix in their code will need to recompile since the
binary format of that struct has changed.

Patrick

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-05-13 21:59 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28  1:32 switched sparse format to binary trees Patrick Alken
2014-04-28 22:35 ` Gerard Jungman
2014-04-29  1:13   ` Patrick Alken
2014-04-29  8:40     ` Frank Reininghaus
2014-04-29 19:15       ` Gerard Jungman
2014-04-29 19:52         ` Patrick Alken
2014-04-29 22:07           ` Gerard Jungman
2014-05-01 18:46             ` Patrick Alken
2014-05-01 23:21               ` Gerard Jungman
2014-05-02  1:48                 ` GSL containers (switched sparse format to binary trees) Gerard Jungman
2014-05-02  1:56                   ` Gerard Jungman
2014-05-02  8:29                     ` Rhys Ulerich
2014-05-02  8:33                       ` Rhys Ulerich
2014-05-02  8:52                         ` Rhys Ulerich
2014-05-02 15:02                     ` Patrick Alken
2014-05-13 21:59                       ` Gerard Jungman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).