MatDenseReplaceArrayWithMemType#
Allows one to replace the array in a MATDENSE, MATDENSECUDA, or MATDENSEHIP with an array provided by the user and a matching PetscMemType. This is useful to avoid copying an array into a matrix.
Synopsis#
#include "petscmat.h"
PetscErrorCode MatDenseReplaceArrayWithMemType(Mat mat, PetscMemType mtype, const PetscScalar array[])
Not Collective
Input Parameters#
mat - the matrix
mtype - the
PetscMemTypeof the arrayarray - the array in column major order
Note#
Adding const to array was an oversight, see notes in VecPlaceArray().
This permanently replaces the GPU array and frees the memory associated with the old GPU array. The memory passed in CANNOT be freed by the user. It will be freed when the matrix is destroyed. The array should respect the matrix leading dimension.
See Also#
MatDenseReplaceArray(), MatDenseCUDAReplaceArray(), MatDenseHIPReplaceArray()
Level#
developer
Location#
src/mat/impls/dense/seq/dense.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages