# Colouring in symmetric and non symmetric block jacobi precond

Hello there,

I was inspecting the source code of `BlockJacobiPrecond` and `BlockJacobiPrecondSymmetric` and I think I have noticed a different strategy for colouring their blocks.

In the first version, the procedure is along the lines of

``````for b in blocks
can_colour = true
for eq in b
if has_color[eq]
can_colour = false

//do some stuff
for eq in b
for eeq in mat.GetRowIndices(eq):
has_color[eq] = true
``````

while on the symmetric version,

``````for b in blocks
can_colour = true
for eq in b
for eeq in mat.GetRowIndices(eq):
if has_color[eeq]
can_colour = false

//do some stuff
for eq in b
for eeq in mat.GetRowIndices(eq):
has_color[eq] = true
``````

Assuming that we have an equation `x` in block `a` and an equation `y` in block `b` and that the dof corresponding to `x` does not affect the residual of `y` (and vice-versa), but they would both affect the residual of a given equation `z` (that does not belong to blocks `a` nor `b`).
If I understood correctly, on the non symmetric version, `a` and `b` could be assigned the same colour. For the symmetric version, this does not hold.

If I may ask, is there a reasoning for this difference?

Hi Francisco,
I am not sure whether this answers the question exactly, but one difference between the non-symmetric and the symmetric one is the following:
In the symmetric one, the row-indices are stored only for the lower triangular matrix. So, in terms of row-indices, it must be more restrictive in comparison to the non-symmetric one.
best, Joachim