1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCopy.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MatCopy</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<div id="version" align=right><b>petsc-3.14.5 2021-03-03</b></div>
<div id="bugreport" align=right><a href="mailto:petsc-maint@mcs.anl.gov?subject=Typo or Error in Documentation &body=Please describe the typo or error in the documentation: petsc-3.14.5 v3.14.5 docs/manualpages/Mat/MatCopy.html "><small>Report Typos and Errors</small></a></div>
<A NAME="MatCopy"><H1>MatCopy</H1></A>
Copies a matrix to another matrix.
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscmat.h"
<A HREF="../Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A HREF="../Mat/MatCopy.html#MatCopy">MatCopy</A>(<A HREF="../Mat/Mat.html#Mat">Mat</A> A,<A HREF="../Mat/Mat.html#Mat">Mat</A> B,<A HREF="../Mat/MatStructure.html#MatStructure">MatStructure</A> str)
</PRE>
Collective on <A HREF="../Mat/Mat.html#Mat">Mat</A>
<P>
<H3><FONT COLOR="#CC3333">Input Parameters</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>A </B></TD><TD>- the matrix
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>str </B></TD><TD>- <A HREF="../Mat/MatStructure.html#MatStructure">SAME_NONZERO_PATTERN</A> or <A HREF="../Mat/MatStructure.html#MatStructure">DIFFERENT_NONZERO_PATTERN</A>
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Output Parameter</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>B </B></TD><TD>- where the copy is put
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
If you use <A HREF="../Mat/MatStructure.html#MatStructure">SAME_NONZERO_PATTERN</A> then the two matrices had better have the
same nonzero pattern or the routine will crash.
<P>
<A HREF="../Mat/MatCopy.html#MatCopy">MatCopy</A>() copies the matrix entries of a matrix to another existing
matrix (after first zeroing the second matrix). A related routine is
<A HREF="../Mat/MatConvert.html#MatConvert">MatConvert</A>(), which first creates a new matrix and then copies the data.
<P>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
<A HREF="../Mat/MatConvert.html#MatConvert">MatConvert</A>(), <A HREF="../Mat/MatDuplicate.html#MatDuplicate">MatDuplicate</A>()
<BR>
<P>
<P><B></B><H3><FONT COLOR="#CC3333">Level</FONT></H3>intermediate<BR>
<H3><FONT COLOR="#CC3333">Location</FONT></H3>
</B><A HREF="../../../src/mat/interface/matrix.c.html#MatCopy">src/mat/interface/matrix.c</A>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/ksp/ksp/tutorials/ex79.c.html">src/ksp/ksp/tutorials/ex79.c.html</A><BR>
<A HREF="../../../src/ts/tutorials/ex3.c.html">src/ts/tutorials/ex3.c.html</A><BR>
<A HREF="../../../src/ts/tutorials/ex50.c.html">src/ts/tutorials/ex50.c.html</A><BR>
<A HREF="../../../src/tao/unconstrained/tutorials/spectraladjointassimilation.c.html">src/tao/unconstrained/tutorials/spectraladjointassimilation.c.html</A><BR>
<A HREF="../../../src/tao/pde_constrained/tutorials/elliptic.c.html">src/tao/pde_constrained/tutorials/elliptic.c.html</A><BR>
<A HREF="../../../src/tao/pde_constrained/tutorials/parabolic.c.html">src/tao/pde_constrained/tutorials/parabolic.c.html</A><BR>
<A HREF="../../../src/tao/pde_constrained/tutorials/hyperbolic.c.html">src/tao/pde_constrained/tutorials/hyperbolic.c.html</A><BR>
<A HREF="../../../src/tao/tutorials/ex4.c.html">src/tao/tutorials/ex4.c.html</A><BR>
<P><H3><FONT COLOR="CC3333">Implementations</FONT></H3><A HREF="../../../src/mat/impls/aij/mpi/mkl_cpardiso/mkl_cpardiso.c.html#MatCopy_seqaij_seqaij_MKL_CPARDISO">MatCopy_seqaij_seqaij_MKL_CPARDISO in src/mat/impls/aij/mpi/mkl_cpardiso/mkl_cpardiso.c</A><BR>
<A HREF="../../../src/mat/impls/aij/mpi/mpiaij.c.html#MatCopy_MPIAIJ">MatCopy_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c</A><BR>
<A HREF="../../../src/mat/impls/aij/seq/aij.c.html#MatCopy_SeqAIJ">MatCopy_SeqAIJ in src/mat/impls/aij/seq/aij.c</A><BR>
<A HREF="../../../src/mat/impls/baij/mpi/mpibaij.c.html#MatCopy_MPIBAIJ">MatCopy_MPIBAIJ in src/mat/impls/baij/mpi/mpibaij.c</A><BR>
<A HREF="../../../src/mat/impls/baij/seq/baij.c.html#MatCopy_SeqBAIJ">MatCopy_SeqBAIJ in src/mat/impls/baij/seq/baij.c</A><BR>
<A HREF="../../../src/mat/impls/dense/seq/dense.c.html#MatCopy_SeqDense">MatCopy_SeqDense in src/mat/impls/dense/seq/dense.c</A><BR>
<A HREF="../../../src/mat/impls/elemental/matelem.cxx.html#MatCopy_Elemental">MatCopy_Elemental in src/mat/impls/elemental/matelem.cxx</A><BR>
<A HREF="../../../src/mat/impls/hypre/mhypre.c.html#MatCopy_HYPRE">MatCopy_HYPRE in src/mat/impls/hypre/mhypre.c</A><BR>
<A HREF="../../../src/mat/impls/is/matis.c.html#MatCopy_IS">MatCopy_IS in src/mat/impls/is/matis.c</A><BR>
<A HREF="../../../src/mat/impls/nest/matnest.c.html#MatCopy_Nest">MatCopy_Nest in src/mat/impls/nest/matnest.c</A><BR>
<A HREF="../../../src/mat/impls/sbaij/mpi/mpisbaij.c.html#MatCopy_MPISBAIJ">MatCopy_MPISBAIJ in src/mat/impls/sbaij/mpi/mpisbaij.c</A><BR>
<A HREF="../../../src/mat/impls/sbaij/seq/sbaij.c.html#MatCopy_SeqSBAIJ">MatCopy_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij.c</A><BR>
<A HREF="../../../src/mat/impls/scalapack/matscalapack.c.html#MatCopy_ScaLAPACK">MatCopy_ScaLAPACK in src/mat/impls/scalapack/matscalapack.c</A><BR>
<A HREF="../../../src/mat/impls/sell/mpi/mpisell.c.html#MatCopy_MPISELL">MatCopy_MPISELL in src/mat/impls/sell/mpi/mpisell.c</A><BR>
<A HREF="../../../src/mat/impls/sell/seq/sell.c.html#MatCopy_SeqSELL">MatCopy_SeqSELL in src/mat/impls/sell/seq/sell.c</A><BR>
<A HREF="../../../src/mat/impls/shell/shell.c.html#MatCopy_Shell">MatCopy_Shell in src/mat/impls/shell/shell.c</A><BR>
<BR><A HREF="./index.html">Index of all Mat routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
</BODY></HTML>
|