This is the mail archive of the
gsl-discuss@sourceware.org
mailing list for the GSL project.
Re: Sparse matrix extension
- From: Patrick Alken <alken at colorado dot edu>
- To: Alexis Tantet <alexis dot tantet at gmail dot com>
- Cc: "gsl-discuss at sourceware dot org" <gsl-discuss at sourceware dot org>
- Date: Sun, 7 Feb 2016 13:14:21 -0700
- Subject: Re: Sparse matrix extension
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=colorado.edu;
- References: <CAMWWPT3uJj4Vrn7ut6+F18gY===zd6+1r1UJhz0hcCj--zwtdg at mail dot gmail dot com> <CAMWWPT3Y=x-vYphaV+2gHPb9WZqEfYdDxs4T0KqBq987VjvDQA at mail dot gmail dot com> <569E6C33 dot 1090505 at colorado dot edu> <CAMWWPT2kMe=R0qUz4P6n_xzG+oW-8pOFwCtBuaritZ5MF6jzAg at mail dot gmail dot com> <569EA1A9 dot 2080101 at colorado dot edu> <CAMWWPT2d=PnK1cexcZ+OLQAYJudRk9QLGac-Wcn33OaES5UjJA at mail dot gmail dot com> <56B689B1 dot 5090005 at colorado dot edu> <CAMWWPT1mog0HrviL1tMo=f-rrSc2PhamWDGg7ZYLrVnnqkY3ng at mail dot gmail dot com> <56B77E13 dot 1000306 at colorado dot edu> <CAMWWPT2KTLjufNdwW=y-xaJ1dKkxDNQwgat4DB4ZwKDrK_fZSA at mail dot gmail dot com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:23
Hi Alexis,
>> I'm not sure what you mean. I've added a new function gsl_spmatrix_ptr
>> to the git, which as far as I can tell does exactly what your
>> sum_duplicate flag does. It searches the matrix for an (i,j) element,
>> and if found returns a pointer. If not found a null pointer is returned.
>> This makes it easy for the user to modify A(i,j) after it has been added
>> to the matrix. Are you thinking of something else? Can you point me to
>> the Eigen routine?
>>
> What I meant is to have the equivalent of gsl_spmatrix_compress,
> with the difference that gsl_spmatrix_ptr is used instead of gsl_spmatrix_set,
> so has to build the compressed matrix from triplets, summing the
> duplicates, instead of replacing them.
> This is what is done here :
> The http://eigen.tuxfamily.org/dox/classEigen_1_1SparseMatrix.html#a5bcf3187e372ff7cea1e8f61152ae49b
>
> Best,
> Alexis
I'm not sure why a user would ever need to do this. The whole point of
the binary tree structure in the triplet storage is to efficiently find
duplicate entries, so that if a user tries to call gsl_spmatrix_set on
an element which is already been previously set, it can find that
element with a binary search (rather than linearly searching the arrays)
and change the value of that element.
Therefore, the way the triplet storage is designed, there is will never
be a duplicate element in the triplet arrays. All of the (i[n],j[n])
will be unique for each n <= nz.
Am I missing something?
Patrick