# Assembling a single element of the stiffness matrix

**URL:** <https://fenicsproject.discourse.group/t/assembling-a-single-element-of-the-stiffness-matrix/1798>\
**Category:** variational formulation\
**Created:** [October 28, 2019, 4:21pm UTC](https://fenicsproject.discourse.group/t/assembling-a-single-element-of-the-stiffness-matrix/1798 "2019-10-28T16:21:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![babak.maboudi](https://avatars.discourse-cdn.com/v4/letter/b/e36b37/32.png) [@babak.maboudi](https://fenicsproject.discourse.group/u/babak.maboudi)\
**Post date:** [October 28, 2019, 4:21pm UTC](https://fenicsproject.discourse.group/t/assembling-a-single-element-of-the-stiffness-matrix/1798/1 "2019-10-28T16:21:32Z")

</div>

I am trying to accelerate the computations of my solver. For this, I need to assemble only a few elements of the stiffness matrix. I can access the stiffness matrix itself using the commands:

a = #some bilinear form  
A = assemble(a)  
A\_mat = A.array()

I only want to know the value A\_mat located for example at [1,3] without computing the rest of the elements. Is this somehow possible?

Many thanks for the help

---

<div class="post-metadata">

**Author:** ![babak.maboudi](https://avatars.discourse-cdn.com/v4/letter/b/e36b37/32.png) [@babak.maboudi](https://fenicsproject.discourse.group/u/babak.maboudi)\
**Post date:** [October 28, 2019, 4:26pm UTC](https://fenicsproject.discourse.group/t/assembling-a-single-element-of-the-stiffness-matrix/1798/2 "2019-10-28T16:26:55Z")

</div>

BTW, I know about assemble\_local(a,c), where c is a cell index. However, I don’t know how the cell index translates to the element in the stiffness matrix.
