diff -r 9e2d4f7f5028 -r 345b1ca54e88 kerneltest/e32utils/nistsecurerng/src/discretefouriertransform.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32utils/nistsecurerng/src/discretefouriertransform.cpp Wed Sep 15 13:42:27 2010 +0300 @@ -0,0 +1,102 @@ +/* +* Portions Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* The original NIST Statistical Test Suite code is placed in public domain. +* (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) +* +* This software was developed at the National Institute of Standards and Technology by +* employees of the Federal Government in the course of their official duties. Pursuant +* to title 17 Section 105 of the United States Code this software is not subject to +* copyright protection and is in the public domain. The NIST Statistical Test Suite is +* an experimental system. NIST assumes no responsibility whatsoever for its use by other +* parties, and makes no guarantees, expressed or implied, about its quality, reliability, +* or any other characteristic. We would appreciate acknowledgment if the software is used. +*/ + +#include "openc.h" +#include "../include/externs.h" +#include "../include/utilities.h" +#include "../include/cephes.h" + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + D I S C R E T E F O U R I E R T R A N S F O R M T E S T + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +void __ogg_fdrffti(int n, double* wsave, int* ifac); +void __ogg_fdrfftf(int n, double* X, double* wsave, int* ifac); + +void +DiscreteFourierTransform(int n) +{ + double p_value, upperBound, percentile, N_l, N_o, d; + double* m = NULL; + double* X = NULL; + double* wsave = NULL; + int* ifac = NULL; + int i, count; + + if ( ((X = (double*) calloc(n,sizeof(double))) == NULL) || + ((wsave = (double *)calloc(2*n+15,sizeof(double))) == NULL) || + ((ifac = (int *)calloc(15,sizeof(int))) == NULL) || + ((m = (double*)calloc(n/2+1, sizeof(double))) == NULL) ) { + fprintf(stats[7],"\t\tUnable to allocate working arrays for the DFT.\n"); + if( X != NULL ) + free(X); + if( wsave != NULL ) + free(wsave); + if( ifac != NULL ) + free(ifac); + if( m != NULL ) + free(m); + return; + } + for ( i=0; i