Subject: [FFC-dev] user defined matrix?

From: Chong Luo <[email-masked]>
Date: Sat, 8 Nov 2008 10:08:11 -0800 (PST)

I'm doing a 2D elasticity problem. In my variational formulation, there are a lot of adj(A), like grad(n)*adj(grad(v)):grad(n)*adj(grad(w)), where adj(A) is the adjoint of the matrix A. That is if A = (a b, c d), then adj(A) = (d -b, -c a).

If I could define adj(A) in the form file, that would be very handy. Is it possible to have user define matrix in FFC? 

Thank you!

Best,
Chong Luo

---

From: Anders Logg <[email-masked]>
Date: Sat, 8 Nov 2008 19:50:53 +0100

On Sat, Nov 08, 2008 at 10:08:11AM -0800, Chong Luo wrote:
> I'm doing a 2D elasticity problem. In my variational formulation, there are a
> lot of adj(A), like grad(n)*adj(grad(v)):grad(n)*adj(grad(w)), where adj(A) is
> the adjoint of the matrix A. That is if A = (a b, c d), then adj(A) = (d -b, -c
> a).

That looks more like an inverse with a missing determinant than an adjoint.

> If I could define adj(A) in the form file, that would be very handy. Is it
> possible to have user define matrix in FFC?

You can define any operators you want in your form file:

def adj(A):
    return [A[0], A[2], A[1]. A[3]]

But note that FFC does not support matrix-valued functions so you'll
have to represent it as a vector.

Matrices (and in general tensors) are supported by the new form
language (UFL) that will be used in FFC in the future.

-- 
Anders

---

From: Chong Luo <[email-masked]>
Date: Mon, 10 Nov 2008 08:51:35 -0800 (PST)

I should have said "adjugate" or "classical adjoint".

I see, matrix can always be treated as vectors, and matrix multiplication, adjugate matrix etc. can be defined accordingly. Thus it's still doable in FFC.

Thank you.

Best,
Chong Luo

________________________________
From: Anders Logg <[email-masked]>
To: [email-masked]
Sent: Saturday, November 8, 2008 12:50:53 PM
Subject: Re: [FFC-dev] user defined matrix?

def adj(A):

-- 
Anders