Subject: [FFC-dev] mixed formulation

From: "Alessio Quaglino" <[email-masked]>
Date: Mon, 20 Aug 2007 12:15:21 +0200 (CEST)

I have a question about matrix multiplication in FFC. Say I want to
measure a certain quantity S in respect to a test function psi belonging
to the same finite space:

S = dot(u, psi) (1)

and then I want to use this measure to assemble the bilinear form where
phi is taken from the same finite space of u:

A = dot(S, grad(phi)) (2)

this is equivalent to assemble the bilinear form (1) obtaining the "m x n"
matrix S and then the bilinear form (2) obtaining the "n x m" matrix A.
Then what I need is to perform the multiplication A*S getting a "n x n"
matrix. Can I write A in such a way that this is done directly in the
form? Do I have to define a trilinear form?

Thanks,
Alessio Quaglino

---

From: Anders Logg <[email-masked]>
Date: Mon, 20 Aug 2007 19:31:27 +0200

I don't see how to do this. As I understand, you have two matrices and 
you want to compute their product. So you want to compute a sum of 
products of integrals. I don't know how to write this as a single 
integral (other than as a "double integral" over the square of the domain).

What is the quantity you want to compute in the end? Can you write it as 
a single integral?

/Anders

Alessio Quaglino wrote:
> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> http://www.fenics.org/mailman/listinfo/ffc-dev

---

From: "Alessio Quaglino" <[email-masked]>
Date: Tue, 21 Aug 2007 19:12:04 +0200 (CEST)

I was confusing with the notation not distinguishing between S as a
function or as its coefficients. What I'm thinking is to write first the
unknowns S and u using the basis functions (indicated with the name of the
test function belonging to the same space):

S = S_coeff psi_trial
u = u_coeff phi_trial

so that we have:

A = dot(S, grad(phi)) =
= S_coeff (psi_trial, grad(phi)) =
= dot(u, psi) * (psi_trial, grad(phi)) =
= u_coeff * dot(phi_basis, psi) * (basis_psi, grad(phi))

the problem is that the two terms have first to be integrated and then
multiplied. Would that be possible?

Thanks,
Alessio

---

From: Anders Logg <[email-masked]>
Date: Tue, 21 Aug 2007 20:11:24 +0200

I'm not sure I follow your notation completely, but no you can't write 
something in FFC that is the product of two integrals. You need to 
compute each integral separately (or find a clever way to rewrite it as 
a single integral over the domain).

/Anders

---

From: "Alessio Quaglino" <[email-masked]>
Date: Wed, 22 Aug 2007 02:07:13 +0200 (CEST)

Yes, the final line of the expression should have *_trial instead of
*_basis. Ok thanks, can I call some specialized function of BLAS for the
matrix product using dolfin or do I have to define a child matrix class
derived from uBlasSparseMatrix?

Thanks,
Alessio

>>>> this is equivalent to assemble the bilinear form (1) obtaining the "m
>>>> x
>>>> n"

---

From: Anders Logg <[email-masked]>
Date: Thu, 23 Aug 2007 17:26:26 +0200

If you have a uBlasMatrix, then you can do everything with it that is 
supported by uBlas, including matrix-matrix products etc. (See uBLAS 
manual.)

/Anders