PETSc version 3.17.4
Fix/Edit manual page

# MatCreateSeqAIJFromTriple

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

### Synopsis

    #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

### 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

### Notes

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()

### Level

intermediate

### Location

src/mat/impls/aij/seq/aij.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages