← Back to team overview

ufl team mailing list archive

Re: [HG UFL] ad test

 

UFL doesn't do any simplifications and rewriting at all, by design.
Rewriting rules are not reversible in general, but can always be
applied later. The exception is that obvious zeros are removed in
some key places, e.g. 0*f -> 0, 0+f -> f, and during AD.

The same applies for the flattening of expressions like (f*f)*f -> (f*f*f)
which is implemented as a function. We may collapse (f*f*f) to 3*f
in that routine as well, but in general the problem of deciding which
simplifications it is a good idea to do does not have a unique solution.

The form compiler may or may not be able to use information
from the original expression form in heuristics for optimization.

The latex compiler will produce bad output (not close to user input)
if we do too much automatic simplifications.

--
Martin


2008/9/24 Kent Andre <kent-and@xxxxxxxxx>:
>
> I tried:
> a = f*f*f*f*f*f*v*dx
> b = derivative(a, f)
>
> which gets a bit larger than it should:
>
> { (((((((((((v_0 * w_0) + (w_0 * v_0)) * w_0) + ((w_0 * w_0) * v_0)) *
> w_0) + (((w_0 * w_0) * w_0) * v_0)) * w_0) + ((((w_0 * w_0) * w_0) *
> w_0) * v_0)) * w_0) + (((((w_0 * w_0) * w_0) * w
> _0) * w_0) * v_0)) * v_-2) } * dx0
>
> Or is this an efficient way to represent it ?
>
> Kent
>
>
> On on., 2008-09-24 at 15:37 +0200, UFL wrote:
>> One or more new changesets pushed to the primary ufl repository.
>> A short summary of the last three changesets is included below.
>>
>> changeset:   261:47f24c5a799264152018ebb14d5c623206cb8c12
>> tag:         tip
>> user:        "Kent-Andre Mardal <kent-and@xxxxxxxxx>"
>> date:        Wed Sep 24 15:37:24 2008 +0200
>> files:       demo/ad_ex1.ufl
>> description:
>> ad test
>>
>>
>> changeset:   260:4e87970569562901a101b2bc90b916c90e552cfd
>> user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
>> date:        Wed Sep 24 15:28:22 2008 +0200
>> files:       test/classcoverage.py test/mass.py ufl/algorithms/ad.py ufl/algorithms/transformations.py ufl/algorithms/ufl2latex.py ufl/formoperators.py
>> description:
>> Some bugfixes and test fixes.
>> Some tests fail, but that's ok for now.
>>
>>
>> changeset:   259:5693657007c3c3fbb954aaf20aecabb4761f5608
>> user:        "Martin Sandve Alnæs <martinal@xxxxxxxxx>"
>> date:        Wed Sep 24 14:06:55 2008 +0200
>> files:       ufl/algorithms/ad.py ufl/base.py ufl/baseoperators.py ufl/common.py
>> description:
>> More AD rules, most important ones are in place now.
>>
>> ----------------------------------------------------------------------
>> For more details, visit http://www.fenics.org/hg/ufl
>> _______________________________________________
>> UFL-dev mailing list
>> UFL-dev@xxxxxxxxxx
>> http://fenics.org/mailman/listinfo/ufl-dev
>
> _______________________________________________
> UFL-dev mailing list
> UFL-dev@xxxxxxxxxx
> http://fenics.org/mailman/listinfo/ufl-dev
>


Follow ups

References