help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fem-fenics questions


From: Marco Vassallo
Subject: Re: fem-fenics questions
Date: Tue, 4 Mar 2014 08:59:55 +0000




On Tue, Mar 4, 2014 at 8:30 AM, Daniel Kraft <address@hidden> wrote:
Hi!

On 2014-03-03 13:01, Marco Vassallo wrote:
> On Mon, Mar 3, 2014 at 11:50 AM, Daniel Kraft <address@hidden
> <mailto:address@hidden>> wrote:
>     > I think that we can do either a function with a different signature:
>     >
>     >   feval ( function function_name, Array<double> x_coordinates,
>     >              Array<double> y_coordinates, Array<double> z_coordinates)
>     >
>     > or a function with a similar signature as the one we are using now but
>     > receiving a matrix
>     > of points and not an array. What do you think?
>     > If you want to implement it or you have any better idea it would
>     be great.
>
>     I would probably go for this signature anyway -- it seems more intuitive
>     to do "feval(func, x, y)" instead of "feval(func, [x, y])" since the
>     former is closer to "func(x, y)".
>
>     If it isn't a problem to make the old convention obsolete, I can work on
>     a patch to change the feval semantics that way (and also to handle
>     multiple points in a loop).  If we want to keep supporting the old call
>     (not sure how many users there are already out there), it should be easy
>     enough to handle that in case feval has only two arguments, and I can
>     also do that.
>
>     What do you think?
>
>
> In my opinion the syntax should be as close as possible to the one from
> FEniCS python.
> You can give a look at what they do for the eval() function and try to
> reproduce it, even if it makes
> my old syntax obsolete.

Looking at [1], it seems that they have the same syntax as you proposed.
 I. e., feval(func, [x, y]) or feval(func, [x, y, z]).

  [1]
http://fenicsproject.org/documentation/dolfin/1.3.0/python/programmers-reference/cpp/function/Function.html#dolfin.cpp.function.Function

My suggestion is still the following, which I find more natural:

* Allow feval(func, [coordinates]) as before for compatibility with the
Python version and the old version in fem-fenics.

* Implement feval(func, x, y) and feval(func, x, y, z), which is in my
opinion more natural.

* In the new version, allow x, y and z to be vectors or matrices so that
one can evaluate the function coordinate-wise for a bunch of points at once.

Please let me know what you think about this proposal -- if it is ok,
I'll work on a patch.

The main goal for fem-fenics in the next months is to be integrated in FEniCS,
 and thus in my opinion it is important to have a syntax as close as possible to it.
On the other side, feval() is also a function in Octave, where the syntax is
[y1, y2, ...] = feval(fname, x1, ..., xn)
 
as you proposed. I think that having the two different functions would be great, so that
both FEniCS and Octave users have something close to what they are used to.

Thanks,

Marco

Yours,
Daniel

--
http://www.domob.eu/
OpenPGP: 901C 5216 0537 1D2A F071  5A0E 4D94 6EED 04F7 CF52
Namecoin: id/domob -> https://nameid.org/?name=domob
--
Done:  Arc-Bar-Cav-Hea-Kni-Ran-Rog-Sam-Tou-Val-Wiz
To go: Mon-Pri



reply via email to

[Prev in Thread] Current Thread [Next in Thread]