Skip to content Skip to navigation

Connexions

You are here: Home » Content » Complex Fourier Series Data Analysis Using C++ and x86 Inline Assembler

Navigation

Recently Viewed

This feature requires Javascript to be enabled.

Complex Fourier Series Data Analysis Using C++ and x86 Inline Assembler

Module by: Marc Balke. E-mail the author

User rating (How does the rating system work?)
Ratings

Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

How to rate a module

Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

:
(0 ratings)

Summary: Complex Fourier Series Written in 80x86 Asembler Using x86 FPU commands, no error checking, utilized in a Visual C++ 2005 function wrapper.

This Function is a small part of a larger data analysis program utilizing Visual C# and Visual C++ to analyze Stock Markets, Stocks, Funds, Options and US Federal Reserve Data. Stock Market, Individual Stocks, Options, Mutual Fund Data or Federal Reserve Economic Data can be analyzed. Input to the function is a double precision (IEEE 754 stanard) vector, containing of one of the data streams from a given series ( Market, Stock, Option, Mutual Fund, FRED ). The start and end pointers into the input vector are required, along with the sample frequency ( Minimum 2x the number of data points supplied ). Output consists of 3 vectors -- Frequency, Amplitude and Phase Shift. By using the Complex Fourier Function, we are able to break down the input data into a Constant ( DC ) component, and variable Frequency, Amplitude and Phase Shift components. Amplitude results of 0 are of no significance. When reconstructed, the data stream should contain future values for the given input data. The idea is to build a more accurate time series forcasting model.

FOURIERDEV_API void DFT64(double* , double* , double* , double* , int ); FOURIERDEV_API void DFT32(float* , float* , float* , float* , int ); FOURIERDEV_API void DFT64(double* dxx, double* cxx, double* th, double* fr, int cnt) { double dxe, cxe, theta, freq, rad, pi2, dne, dnx, cv, cvc; int i, j, n; n = cnt; rad = 360.0; __asm { ; finit; ; fldpi; fldpi; fadd; fstp pi2; ; fld rad; fdiv pi2; fstp rad; ; fld pi2; fchs; fidiv n; fstp pi2; ; mov i,0; ; Loop1: ; ; fild i; fmul pi2; fstp dnx; ; } dxe = *(dxx + i); __asm { ; fldz; fstp cv; ; mov j,0; ; Loop2: ; ; fild j; fmul dnx; fstp dne; ; } cxe = exp(dne); __asm { ; fld cxe; fmul dxe; fadd cv; fstp cv; ; inc j; mov eax,j; cmp eax,n; jl Loop2; ; fld cv; fcos; fmul cv; fdiv cv; fstp cvc; ; } theta = acos(cvc); __asm { ; fld theta; fmul rad; fstp theta; ; fild i; fstp freq; ; } *(cxx + i) = cv; *(th + i) = theta; *(fr + i) = freq; __asm { ; inc i; mov eax,i; cmp eax,n; jl Loop1; ; } } FOURIERDEV_API void DFT32(float* dxx, float* cxx, float* th, float* fr, int cnt) { float dxe, cxe, theta, freq, rad, pi2, dne, dnx, cv, cvc; int i, j, n; n = cnt; rad = 360.0; __asm { ; finit; ; fldpi; fldpi; fadd; fstp pi2; ; fld rad; fdiv pi2; fstp rad; ; fld pi2; fchs; fidiv n; fstp pi2; ; mov i,0; ; Loop1: ; ; fild i; fmul pi2; fstp dnx; ; } dxe = *(dxx + i); __asm { ; fldz; fstp cv; ; mov j,0; ; Loop2: ; ; fild j; fmul dnx; fstp dne; ; } cxe = exp(dne); __asm { ; fld cxe; fmul dxe; fadd cv; fstp cv; ; inc j; mov eax,j; cmp eax,n; jl Loop2; ; fld cv; fcos; fmul cv; fdiv cv; fstp cvc; ; } theta = acos(cvc); __asm { ; fld theta; fmul rad; fstp theta; ; fild i; fstp freq; ; } *(cxx + i) = cv; *(th + i) = theta; *(fr + i) = freq; __asm { ; inc i; mov eax,i; cmp eax,n; jl Loop1; ; } }

Content actions

Give Feedback:

E-mail the module author | Rate module ( How does the rating system work?)

Rating system

Ratings

Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

How to rate a module

Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

(0 ratings)

Download:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.

| A lens (?)

Definition of a lens

Lenses

A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual Connexions member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks