hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_sum_withdraw_conjugate_hermitian_rfmt (c06gb)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_sum_conjugate_hermitian_rfmt (c06gb) forms the complex conjugate of a Hermitian sequence of n data values.
Note: this function is scheduled to be withdrawn, please see c06gb in Advice on Replacement Calls for Withdrawn/Superseded Routines..

Syntax

[x, ifail] = c06gb(x, 'n', n)
[x, ifail] = nag_sum_withdraw_conjugate_hermitian_rfmt(x, 'n', n)

Description

This is a utility function for use in conjunction with nag_sum_fft_real_1d_nowork (c06ea), nag_sum_fft_hermitian_1d_nowork (c06eb), nag_sum_fft_real_1d_rfmt (c06fa) or nag_sum_fft_hermitian_1d_rfmt (c06fb) to calculate inverse discrete Fourier transforms (see the C06 Chapter Introduction).

References

None.

Parameters

Compulsory Input Parameters

1:     xn – double array
If the data values zj are written as xj + i yj and if x is declared with bounds 0:n-1 in the function from which nag_sum_conjugate_hermitian_rfmt (c06gb) is called, then for 0 j n/2, xj must contain xj (= x n-j ), while for n/2 < j n-1, xj must contain -y j  (= y n-j ). In other words, x must contain the Hermitian sequence in Hermitian form. (See also Real transforms in the C06 Chapter Introduction.)

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the dimension of the array x.
n, the number of data values.
Constraint: n1.

Output Parameters

1:     xn – double array
The imaginary parts yj are negated. The real parts xj are not referenced.
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry,n<1.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

Exact.

Further Comments

The time taken by nag_sum_conjugate_hermitian_rfmt (c06gb) is negligible.

Example

This example reads in a sequence of real data values, calls nag_sum_fft_real_1d_nowork (c06ea) followed by nag_sum_conjugate_hermitian_rfmt (c06gb) to compute their inverse discrete Fourier transform, and prints this after expanding it from Hermitian form into a full complex sequence.
function c06gb_example


fprintf('c06gb example results\n\n');

% real data
n = 7;
x = [0.34907  0.54890  0.74776  0.94459  1.13850  1.32850  1.51370];

% transform
[xt, ifail] = c06ea(x);

% get result in form useful for printing.
zt = nag_herm2complex(xt);
disp('Discrete Fourier Transform of x:');
disp(transpose(zt));

% restore by conjugating and backtransforming
[xt, ifail] = c06gb(xt);
[xr, ifail] = c06eb(xt);

fprintf('Original sequence as restored by inverse transform\n\n');
fprintf('       Original   Restored\n');
for j = 1:n
  fprintf('%3d   %7.4f    %7.4f\n',j, x(j),xr(j));
end




function [z] = nag_herm2complex(x);
  n = size(x,2);
  z(1) = complex(x(1));
  for j = 2:floor((n-1)/2) + 1
    z(j) = x(j) + i*x(n-j+2);
    z(n-j+2) = x(j) - i*x(n-j+2);
  end
  if (mod(n,2)==0)
    z(n/2+1) = complex(x(n/2+1));
  end
c06gb example results

Discrete Fourier Transform of x:
   2.4836 + 0.0000i
  -0.2660 + 0.5309i
  -0.2577 + 0.2030i
  -0.2564 + 0.0581i
  -0.2564 - 0.0581i
  -0.2577 - 0.2030i
  -0.2660 - 0.5309i

Original sequence as restored by inverse transform

       Original   Restored
  1    0.3491     0.3491
  2    0.5489     0.5489
  3    0.7478     0.7478
  4    0.9446     0.9446
  5    1.1385     1.1385
  6    1.3285     1.3285
  7    1.5137     1.5137

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015