← Back to team overview

ufl team mailing list archive

Re: abs

 

On Thu, Jan 1, 2009 at 5:54 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> On Thu, Jan 01, 2009 at 04:43:24PM +0100, Martin Sandve Alnæs wrote:
>> UFL supports absolute values of any scalar expression.
>>
>> Martin
>
> What about vectors/tensors?
>
> Perhaps we could add a mechanism for applying scalar-to-scalar
> operators to all elements of a tensor (like .* etc in MATLAB).
>
> Maybe something like this:
>
>  _.abs(expression)
>
> We can have a module named _ that contains special versions of all
> operators.

With current features, this can be expressed like:

as_tensor(abs(expression[i,j]), (i,j))

But in the case of abs, abs(expression) should be fine.

Martin


Follow ups

References