Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

Sorted usings and removed unused usings in entire solution (#1094)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.ALGLIB/2.5.0/ALGLIB-2.5.0/fht.cs

    r3839 r4068  
    1919*************************************************************************/
    2020
    21 using System;
    2221
    23 namespace alglib
    24 {
    25     public class fht
    26     {
    27         /*************************************************************************
    28         1-dimensional Fast Hartley Transform.
     22namespace alglib {
     23  public class fht {
     24    /*************************************************************************
     25    1-dimensional Fast Hartley Transform.
    2926
    30         Algorithm has O(N*logN) complexity for any N (composite or prime).
     27    Algorithm has O(N*logN) complexity for any N (composite or prime).
    3128
    32         INPUT PARAMETERS
    33             A   -   array[0..N-1] - real function to be transformed
    34             N   -   problem size
     29    INPUT PARAMETERS
     30        A   -   array[0..N-1] - real function to be transformed
     31        N   -   problem size
    3532           
    36         OUTPUT PARAMETERS
    37             A   -   FHT of a input array, array[0..N-1],
    38                     A_out[k] = sum(A_in[j]*(cos(2*pi*j*k/N)+sin(2*pi*j*k/N)), j=0..N-1)
     33    OUTPUT PARAMETERS
     34        A   -   FHT of a input array, array[0..N-1],
     35                A_out[k] = sum(A_in[j]*(cos(2*pi*j*k/N)+sin(2*pi*j*k/N)), j=0..N-1)
    3936
    4037
    41           -- ALGLIB --
    42              Copyright 04.06.2009 by Bochkanov Sergey
    43         *************************************************************************/
    44         public static void fhtr1d(ref double[] a,
    45             int n)
    46         {
    47             ftbase.ftplan plan = new ftbase.ftplan();
    48             int i = 0;
    49             AP.Complex[] fa = new AP.Complex[0];
     38      -- ALGLIB --
     39         Copyright 04.06.2009 by Bochkanov Sergey
     40    *************************************************************************/
     41    public static void fhtr1d(ref double[] a,
     42        int n) {
     43      ftbase.ftplan plan = new ftbase.ftplan();
     44      int i = 0;
     45      AP.Complex[] fa = new AP.Complex[0];
    5046
    51             System.Diagnostics.Debug.Assert(n>0, "FHTR1D: incorrect N!");
    52            
    53             //
    54             // Special case: N=1, FHT is just identity transform.
    55             // After this block we assume that N is strictly greater than 1.
    56             //
    57             if( n==1 )
    58             {
    59                 return;
    60             }
    61            
    62             //
    63             // Reduce FHt to real FFT
    64             //
    65             fft.fftr1d(ref a, n, ref fa);
    66             for(i=0; i<=n-1; i++)
    67             {
    68                 a[i] = fa[i].x-fa[i].y;
    69             }
    70         }
     47      System.Diagnostics.Debug.Assert(n > 0, "FHTR1D: incorrect N!");
     48
     49      //
     50      // Special case: N=1, FHT is just identity transform.
     51      // After this block we assume that N is strictly greater than 1.
     52      //
     53      if (n == 1) {
     54        return;
     55      }
     56
     57      //
     58      // Reduce FHt to real FFT
     59      //
     60      fft.fftr1d(ref a, n, ref fa);
     61      for (i = 0; i <= n - 1; i++) {
     62        a[i] = fa[i].x - fa[i].y;
     63      }
     64    }
    7165
    7266
    73         /*************************************************************************
    74         1-dimensional inverse FHT.
     67    /*************************************************************************
     68    1-dimensional inverse FHT.
    7569
    76         Algorithm has O(N*logN) complexity for any N (composite or prime).
     70    Algorithm has O(N*logN) complexity for any N (composite or prime).
    7771
    78         INPUT PARAMETERS
    79             A   -   array[0..N-1] - complex array to be transformed
    80             N   -   problem size
     72    INPUT PARAMETERS
     73        A   -   array[0..N-1] - complex array to be transformed
     74        N   -   problem size
    8175
    82         OUTPUT PARAMETERS
    83             A   -   inverse FHT of a input array, array[0..N-1]
     76    OUTPUT PARAMETERS
     77        A   -   inverse FHT of a input array, array[0..N-1]
    8478
    8579
    86           -- ALGLIB --
    87              Copyright 29.05.2009 by Bochkanov Sergey
    88         *************************************************************************/
    89         public static void fhtr1dinv(ref double[] a,
    90             int n)
    91         {
    92             int i = 0;
     80      -- ALGLIB --
     81         Copyright 29.05.2009 by Bochkanov Sergey
     82    *************************************************************************/
     83    public static void fhtr1dinv(ref double[] a,
     84        int n) {
     85      int i = 0;
    9386
    94             System.Diagnostics.Debug.Assert(n>0, "FHTR1DInv: incorrect N!");
    95            
    96             //
    97             // Special case: N=1, iFHT is just identity transform.
    98             // After this block we assume that N is strictly greater than 1.
    99             //
    100             if( n==1 )
    101             {
    102                 return;
    103             }
    104            
    105             //
    106             // Inverse FHT can be expressed in terms of the FHT as
    107             //
    108             //     invfht(x) = fht(x)/N
    109             //
    110             fhtr1d(ref a, n);
    111             for(i=0; i<=n-1; i++)
    112             {
    113                 a[i] = a[i]/n;
    114             }
    115         }
     87      System.Diagnostics.Debug.Assert(n > 0, "FHTR1DInv: incorrect N!");
     88
     89      //
     90      // Special case: N=1, iFHT is just identity transform.
     91      // After this block we assume that N is strictly greater than 1.
     92      //
     93      if (n == 1) {
     94        return;
     95      }
     96
     97      //
     98      // Inverse FHT can be expressed in terms of the FHT as
     99      //
     100      //     invfht(x) = fht(x)/N
     101      //
     102      fhtr1d(ref a, n);
     103      for (i = 0; i <= n - 1; i++) {
     104        a[i] = a[i] / n;
     105      }
    116106    }
     107  }
    117108}
Note: See TracChangeset for help on using the changeset viewer.