我有用 c++ 编写的顺序块 AIJ 矩阵,我将使用 PETSc 创建 MPI 矩阵。所以,我必须将我的稀疏块 AIJ 矩阵替换为 MPI 块 AIJ PETSc 矩阵。有没有人有任何关于如何做到这一点的例子?我将不胜感激有关我想做的任务的任何建议。
1 回答
0
一个好的起点可能是http://www.mcs.anl.gov/petsc/petsc-current/src/mat/examples/tutorials/ex5.c.html:
Opens a separate file for each process and reads in ITS portion
of a large parallel matrix. Only requires enough memory to store
the processes portion of the matrix ONCE.
它利用MatSetValues()
设置值。仔细阅读文档以了解您应该做什么: http ://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValues.html 。PETSC'manual on Mat 章节也会对您有所帮助。
如果您想使用阻塞矩阵 (BAIJ),您可以使用MatSetValuesBlocked()
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValuesBlocked.html#MatSetValuesBlocked
(and MatSetBlockSize()
)
再见,
于 2014-04-24T19:03:22.293 回答