Re: [petsc-users] Question about handling matrix

2023-02-01 Thread 김성익
Both small and large matrix are sparse matrix.
I will try following comments.

Thanks,
Hyung Kim

2023년 2월 1일 (수) 오후 11:30, Jed Brown 님이 작성:

> Is the small matrix dense? Then you can use MatSetValues. If the small
> matrix is sparse, you can assemble it with larger dimension (empty rows and
> columns) and use MatAXPY.
>
> 김성익  writes:
>
> > Hello,
> >
> >
> > I want to put small matrix to large matrix.
> > The schematic of operation is as below.
> > [image: image.png]
> > Is there any function for put small matrix to large matrix at once?
> >
> > Thanks,
> > Hyung Kim
>


Re: [petsc-users] Question about handling matrix

2023-02-01 Thread Jed Brown
Is the small matrix dense? Then you can use MatSetValues. If the small matrix 
is sparse, you can assemble it with larger dimension (empty rows and columns) 
and use MatAXPY.

김성익  writes:

> Hello,
>
>
> I want to put small matrix to large matrix.
> The schematic of operation is as below.
> [image: image.png]
> Is there any function for put small matrix to large matrix at once?
>
> Thanks,
> Hyung Kim


Re: [petsc-users] Question about handling matrix

2023-02-01 Thread Mark Adams
Maybe create the large matrix and use
https://www.mcs.anl.gov/petsc/petsc-3.7/docs/manualpages/Mat/MatGetSubMatrix.html
with MAT_REUSE_MATRIX.

Or pad the IS arguments to MatGetSubMatrix with -1, so the size is correct
and PETSc should ignore -1, and use MAT_INITIAL_MATRIX.

Others may know what will work.

Good luck,
Mark

On Wed, Feb 1, 2023 at 5:26 AM 김성익  wrote:

> Hello,
>
>
> I want to put small matrix to large matrix.
> The schematic of operation is as below.
> [image: image.png]
> Is there any function for put small matrix to large matrix at once?
>
> Thanks,
> Hyung Kim
>


[petsc-users] Question about handling matrix

2023-02-01 Thread 김성익
Hello,


I want to put small matrix to large matrix.
The schematic of operation is as below.
[image: image.png]
Is there any function for put small matrix to large matrix at once?

Thanks,
Hyung Kim