← Back to team overview

fenics team mailing list archive

Re: The order of test and trial functions

 

On Wed, May 05, 2010 at 09:05:19AM +0100, Garth N. Wells wrote:
>
>
> On 04/05/10 20:32, Anders Logg wrote:
> >On Mon, May 03, 2010 at 11:08:13AM +0200, Kent Andre wrote:
> >>On Mon, 2010-05-03 at 09:36 +0100, Garth N. Wells wrote:
> >>>
> >>>On 03/05/10 08:48, Kent Andre wrote:
> >>>>
> >>>>I am in favour of a(u,v), simply because it is the way I am used to
> >>>>read and write it. Also, very few users need to care about this due to
> >>>>the high-level syntax in UFL which implicitly takes care of the
> >>>>ordering.
> >>>>
> >>>
> >>>They do need to worry about it on the DOLFIN side with the creation of a
> >>>Form:
> >>>
> >>>     Poissin::Bilinearform a(V0, V1);
> >>>
> >>>Garth
> >>>
> >>
> >>Yes, of course, sorry, in C++ this is important,
> >>
> >>Anyway, I think both alternatives have their advantages.
> >>But, as Godel put it, you must choose between consistency and
> >>conformity :)
> >
> >I've been thinking some more, and I'm getting more convinced that the
> >problem is really the ordering of rows and columns in matrices, which
> >should be (column, row) rather than (row, column) because a matrix is
> >really a set of columns that span the range of A, so A_i should be
> >column i and A_ij should be element j of that column.
> >
> >So then a(u, v) would be consistent with *that* notation but it would
> >be a pain for us to have an unorthodox matrix index notation.
> >
> >Which leaves us with the following options:
> >
> >1. Keep a(v, u) as we have now and not change anything.
> >
> >2. Change to a(u, v) and comment on the need for swapping the indices
> >when we define the matrix (tensor) in the text (book and manual).
> >
> >Alternative (2) would imply the following changes:
> >
> >(i) Redefine the UFC interface so that the test space is the last
> >space, not the first.
> >
> >(ii) Swapping of indices inside Assembler.cpp.
> >
> >Further comments?
> >
>
> (1) sounds best/easiest.
>
> In terms of user code, it's not such a big deal since it only
> becomes important when declaring in C++ a bilinear form which uses
> different spaces for the test and trial function.
>
> Garth

But my biggest concern is consistency. There are many pages in the
book that deal with representation of forms, linearization of forms,
assembly of forms; a(v, u), F(v; u) appear in I don't know how many
places. I think it would be very confusing to write a(u, v) and then
change to a(v, u) at some arbitrary point in the text. It would then
not be enough to comment on the issue of the order of v and u in one
place, but we would need to do it in many places.

I'm open for (2), especially if my conclusions of the order of indices
in matrices is correct. The change we would need to make in the text
is to define

  A_i^T = a(\phi_{i_1}, \phi_{i_2}, \phi_{i_3}, ...)

that is, we add a transpose to the tensor A (which we would take to
mean reverse the indices).

We would also need to deal with the transpose operation in the
assembler (easy fix) and redefine the UFC interface (harder).

--
Anders

Attachment: signature.asc
Description: Digital signature


References