[Trilinos-Users] Creating a non-square Tpetra::CrsMatrix

Jason Monschke jam4375 at gmail.com
Thu Feb 5 12:53:07 MST 2015


Hi,

I'm trying to build a non-square Tpetra::CrsMatrix but am having trouble.
What is the correct way to construct a non-square CrsMatrix? Below is an
excerpt of what I've tried:


using Teuchos::rcp;
using Teuchos::RCP;

typedef Tpetra::Map<> map_type;
typedef Tpetra::CrsMatrix<double> mat_type;

RCP<const Teuchos::Comm<int> > comm =
Tpetra::DefaultPlatform::getDefaultPlatform().getComm();

int N = 100;
int M = 50;

auto domain_map = rcp(new map_type(N, 0, comm,
Tpetra::GloballyDistributed));
auto range_map = rcp(new map_type(M, 0, comm, Tpetra::LocallyReplicated));
auto C = rcp(new mat_type(domain_map, range_map, 0));

// Insert values in C

C->fillComplete(domain_map, range_map);

std::cout << C->getGlobalNumRows() << std::endl;
std::cout << C->getGlobalNumCols() << std::endl;


The output for one process is:
100
100
but I would like it to be:
100
50

Thank you for your help,
Jason


-- 
Jason A. Monschke
Graduate Research Assistant
Klebanoff-Saric Wind Tunnel | Department of Aerospace Engineering | Texas
A&M University
Email: jam4375 at gmail.com | KSWT: 979-862-2209 | Cell: 979-450-0889
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://software.sandia.gov/pipermail/trilinos-users/attachments/20150205/6dc773a3/attachment.html>


More information about the Trilinos-Users mailing list