← Back to team overview

ufl team mailing list archive

diagonal of a tensor

 

Hello!

Is there an easy way to extract the diagonal of a square tensor in ufl? I know 
I can do:

  diag = as_vector([A[0][0], A[1][1]])

but it would make sense to have something like:

  diag(A), A.diag()

Johan


Follow ups