Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • T Trilinos
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 936
    • Issues 936
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • James Willenbring
  • Trilinos
  • Issues
  • #3322

Closed
Open
Created Aug 20, 2018 by James Willenbring@jmwilleMaintainer

Epetra_CrsMatrix: InsertMyValues() is not working correctly

Created by: freaklovesmango

I am using the InsertMyValues() method of Epetra_CrsMatrix. However, it does not set the Col Index' correctly and I do not know why. If I change the visibility of the method InsertValues() which is called by InsertMyValues() from protected/private to public and use this instead of the other, the column IDs are set correctly. Basically, what my code does is similar to this short version:

double c = 0.9;
for (int r = 0;  r < 6; ++r ){
    	crsMatrix.InsertMyValues(r, 1, &c, &r);
    }
std::cout << "The Matrix with InsertMyValues(): \n " << crsMatrix << std::endl;

where crsMatrix is a Epetra_CrsMatrix with a serial communicator. The output is this:

The Matrix with InsertMyValues():
Epetra::CrsMatrix
Number of Global Rows        = 6
Number of Global Cols        = 6
Number of Global Diagonals   = 0
Number of Global Nonzeros    = 0
Global Maximum Num Entries   = 0
 ** Matrix is Lower Triangular **
 ** Matrix is Upper Triangular **
 ** Matrix has no diagonal     **


Number of My Rows        = 6
Number of My Cols        = 6
Number of My Diagonals   = 0
Number of My Nonzeros    = 0
My Maximum Num Entries   = 1

   Processor    Row Index    Col Index           Value     
       0             0            -1                     0.9    
       0             1            -1                     0.9    
       0             2            -1                     0.9    
       0             3            -1                     0.9    
       0             4            -1                     0.9    
       0             5            -1                     0.9 

wheras with InsertValues() the output is correct like this:

The Matrix with InsertValues():
Epetra::CrsMatrix
Number of Global Rows        = 6
Number of Global Cols        = 6
Number of Global Diagonals   = 0
Number of Global Nonzeros    = 0
Global Maximum Num Entries   = 0
 ** Matrix is Lower Triangular **
 ** Matrix is Upper Triangular **
 ** Matrix has no diagonal     **


Number of My Rows        = 6
Number of My Cols        = 6
Number of My Diagonals   = 0
Number of My Nonzeros    = 0
My Maximum Num Entries   = 1

   Processor    Row Index    Col Index           Value     
       0             0             0                     0.9    
       0             1             1                     0.9    
       0             2             2                     0.9    
       0             3             3                     0.9    
       0             4             4                     0.9    
       0             5             5                     0.9   
Assignee
Assign to
Time tracking