### Adding two matrix with different sparsity pattern

208

views

1

Hi,

I was wondering if there is a way of adding 2 different matrix with different sparsity pattern. More specifically, I have a matrix "assembled" in fenics and I want to add another self-constructed matrix (with the same dimension but different sparsity pattern to it). Is there a way to do it?

Thanks!

I was wondering if there is a way of adding 2 different matrix with different sparsity pattern. More specifically, I have a matrix "assembled" in fenics and I want to add another self-constructed matrix (with the same dimension but different sparsity pattern to it). Is there a way to do it?

Thanks!

Community: FEniCS Project

That works! Thanks so much!

written
7 months ago by
Lik Chuan Lee

### 1 Answer

1

If you want A1+A2, I think you can try to use axpy and set the last argument to False.

`A1.axpy(1.0, A2, False)`

Please login to add an answer/comment or follow this question.