Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Manually setting matrix entries #261

Open
@mkofler96

Description

@mkofler96

Hello,

I was wondering if it is possible to manually set entries of the matrix in the linear system.

If I look at the example given at the main page, I would like to manually change the sparse matrixAA.

# Form the linear system of equations (AX=B)A=mfem.OperatorPtr()B=mfem.Vector()X=mfem.Vector()a.FormLinearSystem(ess_tdof_list,x,b,A,X,B)print("Size of linear system: "+str(A.Height()))# Solve the linear system using PCG and store the solution in xAA=mfem.OperatorHandle2SparseMatrix(A)# worksAA.Set(0,0,1)# does not workAA.Set(0,10,1)

While changinging the entry (0,0) works, because it is already present, adding a new entry at (0,10) gives the following error:

MFEMabort:Couldnotfindentryforrow=0,col=10 ...infunction:mfem::real_t&mfem::SparseMatrix::SearchRow(int,int) ...infile:/__w/PyMFEM/PyMFEM/PyMFEM/external/mfem/linalg/sparsemat.hpp:930Traceback (mostrecentcalllast):File"/usr2/mkofler/PyMFEM/examplefrom_git.py",line43,in<module>AA.Set(0,10,1)RuntimeError:PyMFEMerror (mfem::ErrorException):MFEMabort:Couldnotfindentryforrow=0,col=10 ...infunction:mfem::real_t&mfem::SparseMatrix::SearchRow(int,int) ...infile:/__w/PyMFEM/PyMFEM/PyMFEM/external/mfem/linalg/sparsemat.hpp:930

Is there another possibility of how I could do this? I was also looking for a way to convert the sparse matrix to a dense matrix and changing the entries there, but I have not found a way of doing this.

I would be happy if someone could help me out here and thanks for the great work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp