libMesh / libmesh

libMesh github repository
http://libmesh.github.io
GNU Lesser General Public License v2.1
654 stars 286 forks source link

Create zero_rows_and_columns API in SparseMatrix #3540

Open lindsayad opened 1 year ago

lindsayad commented 1 year ago

idaholab/moose#24209 has to cast to a petsc matrix and then manually call the corresponding PETSc API. We should be able to abstract that in libMesh

zachmprince commented 1 year ago

MatMultTranspose would also be helpful. Probably would call it transpose_vec_mult.

jwpeterson commented 1 year ago

@zachmprince It's not the most intuitive interface in the world, but possibly NumericVector::add_vector_transpose could work for your purposes.

  /**
   * Computes \f$ \vec{u} \leftarrow \vec{u} + A^T \vec{v} \f$,
   * i.e. adds the product of the transpose of a \p SparseMatrix \p A
   * and a \p NumericVector \p v to \p this.
   */
  virtual void add_vector_transpose (const NumericVector<T> & v,
                                     const SparseMatrix<T> & A) = 0;
zachmprince commented 1 year ago

Thank you @jwpeterson! This does work. I didn't expect this to be in the NumericVector class.