petsc-3.7.2 2016-06-05
Report Typos and Errors


Creates an sequential AIJ matrix using matrix elements (in COO format) provided by the user.


#include "petscmat.h" 
PetscErrorCode  MatCreateSeqAIJFromTriple(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt *i,PetscInt *j,PetscScalar *a,Mat *mat,PetscInt nz,PetscBool idx)
Collective on MPI_Comm

Input Parameters

comm - must be an MPI communicator of size 1
m - number of rows
n - number of columns
i - row indices
j - column indices
a - matrix values
nz - number of nonzeros
idx - 0 or 1 based

Output Parameter

mat -the matrix


The i and j indices are 0 based

The format which is used for the sparse matrix input, is equivalent to a row-major ordering.. i.e for the following matrix, the input data expected is

as shown

1 0 0 2 0 3 4 5 6

i = {0,1,1,2,2,2} j = {0,0,2,0,1,2} v = {1,2,3,4,5,6}

See Also

MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateSeqAIJWithArrays(), MatMPIAIJSetPreallocationCSR()

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages