You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sébastien Brisard (Commented JIRA)" <ji...@apache.org> on 2012/02/10 09:55:59 UTC

[jira] [Commented] (MATH-743) Use enums in package transform

    [ https://issues.apache.org/jira/browse/MATH-743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13205295#comment-13205295 ] 

Sébastien Brisard commented on MATH-743:
----------------------------------------

In revision {{r1242703}}, introduced
* enumeration {{TransformType}}, with two values {{FORWARD}} and {{INVERSE}}
* enumeration {{FastFourierTransformer.DftNormalization}}, with two values {{STANDARD}} and {{UNITARY}}.

In {{FastFourierTransformer}}, the normalization is now specified at construction time, while the type is specified in the methods {{Complex[] transform(Complex[], TransformType)}} and the likes. The rationale is that no matter the transform (DFT, DST, DCT, DHT), forward and inverse are always meaningful (so {{TransformType}} is shared by *all* transforms). On the other hand, normalization is transform specific. For example, DST and DCT can be made orthogonal, while FFT can be made unitary (orthogonal doesn't mean anything with complex transforms).

This API change greatly simplifies unit testing, as it is now possible to *loop* over the types and normalizations!

In order to allow for possible independent implementations of the DFT, I propose that {{DftNormalization}} be a top-level enum, instead of a nested enum. Also, most of the header of the current Javadoc of {{FastFourierTransformer}} should actually move to {{DftNormalization}}.
                
> Use enums in package transform
> ------------------------------
>
>                 Key: MATH-743
>                 URL: https://issues.apache.org/jira/browse/MATH-743
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.0
>            Reporter: Sébastien Brisard
>            Assignee: Sébastien Brisard
>              Labels: api-change, enum, transform
>
> As discussed on the mailing-list, enums could be used in the package {{transform}}
> # An enumeration {{FORWARD, INVERSE}} will be created to specify whether the inverse transform is to be computed. This will replace the pair {{transform}}/{{inverseTransform}}
> # An enumeration {{STANDARD, ORTHOGONAL}} will be introduced (where relevant) in each transform class, in order to specify the normalization that should be used. Then the factory methods {{create()}}/{{createOrthogonal()}} will be replaced by a parameter passed to the constructor, which will be made public.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira