home *** CD-ROM | disk | FTP | other *** search
- //---------------------------------------------------------------------
- //
- // conv
- //
- // Syntax: c=conv(a,b)
- //
- // This routine convolves the vectors a and b into c. It is used for
- // polynomial multiplication (algebraically they are the same
- // operation).
- //
- // Note: Currently no error checking.
- //
- // Written by: Ian Searle
- //---------------------------------------------------------------------
-
- conv = function( x , y )
- {
- local( X , Y , n, tmp );
-
- n = x.n + y.n - 1;
- X = fft( x, n );
- Y = fft( y, n );
-
- tmp = ifft( X .* Y );
- if( type(x) == "real" && type(y) == "real") { tmp = real(tmp); }
-
- return tmp;
- };
-