### Bug in createAIJ function ?

44

views

-1

Hi,

I have a problem with setValuesCSR with a big model. The filling of the matrix is very very long whereas with numpy it is instantaneous. Therefore, i use the createAIJ function in order to filling my matrix. However i have a problem with this function. When i test these lines:

The first solution gives a bad result while the second gives good results. I would like to use the first solution so that I can use the basic functions of fenics (solve, ...). Could you help me ?

Thank you !

Best regards,

Arnaud

I have a problem with setValuesCSR with a big model. The filling of the matrix is very very long whereas with numpy it is instantaneous. Therefore, i use the createAIJ function in order to filling my matrix. However i have a problem with this function. When i test these lines:

```
A1=PETScMatrix()
A1.mat().createAIJ(size=(size_mat+size_groups, size_mat+size_groups), nnz=size_mat+size_groups*2 ,csr=(row_i,AValues[1],AValues[2]))
print A1.mat().getValuesCSR()
A1=PETScMatrix().mat().createAIJ(size=(size_mat+size_groups, size_mat+size_groups), nnz=size_mat+size_groups*2 ,csr=(row_i,AValues[1],AValues[2]))
print A1.getValuesCSR()
Results:
(array([0], dtype=int32), array([], dtype=int32), array([], dtype=float64))
(array([ 0, 9, 18, ..., 578061, 578061, 578061], dtype=int32), array([ 0, 264, 351, ..., 27828, 27829, 27830], dtype=int32), array([ 8.65384615, -1.92307692, -6.73076923, ..., -2.55443313,
-2.72414887, 13.38645699]))
```

The first solution gives a bad result while the second gives good results. I would like to use the first solution so that I can use the basic functions of fenics (solve, ...). Could you help me ?

Thank you !

Best regards,

Arnaud

Community: FEniCS Project

### 2 Answers

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

Omit boilerplate like Hi and Regards, it is useless in QA forum.