← Back to team overview

ufl team mailing list archive

Re: diagonal of a tensor

 

There is no such operator, but it would make sense yes.

Just define it yourself for now with def diag(A), should be trivial to add
to ufl.

Martin
Den 3. nov. 2011 00.13 skrev "Johan Hake" <johan.hake@xxxxxxxxx> følgende:

> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~ufl
> Post to     : ufl@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ufl
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References