[Trilinos-Users] [EXTERNAL] Constructing a CrsMatrix with just a row map

Christopher Thiele christopher.thiele92 at gmail.com
Mon Sep 21 19:00:04 EDT 2015


Hello Andrew,

Thank you for the fast reply. Calling the constructor with 0 as second
argument seems to work. However, I did not find a way to set the matrix
values correctly. I have three (standard C) arrays that contain the row and
column index, as well as the value for each entry. There might be several
values for the same entry that should be summed up. Thus I would like to
use sumIntoGlobalValues(), but this does not seem to work. Instead I think
I have to use insertGlobalValues() for the first value of an entry and then
sumIntoGlobalValues() for all further values, which is quite hard to
implement, as the arrays are not sorted. Is there an easier way to do this?

Best,
Christopher

On Mon, Sep 21, 2015 at 4:44 PM, Bradley, Andrew Michael <ambradl at sandia.gov
> wrote:

> Hi Christopher,
>
>
> I think the ctor taking row map only used to default the second argument,
> maxNumEntriesPerRow, to 0. Now it doesn't. But you can set it to 0 to
> achieve what you want. So pass the row map as the first arg and 0 as the
> second.
>
>
> Cheers,
>
> Andrew
>
>
> ------------------------------
> *From:* Trilinos-Users <trilinos-users-bounces at trilinos.org> on behalf of
> Christopher Thiele <christopher.thiele92 at gmail.com>
> *Sent:* Monday, September 21, 2015 3:38 PM
> *To:* trilinos-users at trilinos.org
> *Subject:* [EXTERNAL] [Trilinos-Users] Constructing a CrsMatrix with just
> a row map
>
> Hello,
>
> I want to construct a Tpetra::CrsMatrix, but I do not know the number of
> non-zeros in advance. According to the Tpetra introduction (
> https://trilinos.org/docs/r12.2/packages/tpetra/doc/html/Tpetra_Lesson04.html)
> it should be possible to construct one with just a row map. However, when I
> try to do it as in the example, I get a compilation error, because there
> seems to be no constructor for this. The only constructor for CrsMatrix
> that takes only one argument wants a CrsGraph instead of a Map. I am using
> Trilinos 12.2.2.1, i.e. the same version as in the introduction.
>
> Is there another way to create an "empty" matrix?
>
> I appreciate any suggestions.
>
> Regards,
> Christopher
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20150921/3a91c26c/attachment.html>


More information about the Trilinos-Users mailing list