⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xcor.c

📁 su 的源代码库
💻 C
字号:
/* Copyright (c) Colorado School of Mines, 2006.*//* All rights reserved.                       *//*********************** self documentation **********************//*****************************************************************************XCOR - Compute z = x cross-correlated with yxcor	compute z= x cross-correlated with y******************************************************************************Function Prototype:void xcor (int lx, int ifx, float *x, int ly, int ify, float *y ,	int lz, int ifz, float *z);******************************************************************************Input:lx		length of x arrayifx		sample index of first xx		array[lx] to be cross-correlated with yly		length of y arrayify		sample index of first yy		array[ly] with which x is to be cross-correlatedlz		length of z arrayifz		sample index of first zOutput:z		array[lz] containing x cross-correlated with y******************************************************************************Notes:See notes for convolution function conv().The operation "x cross correlated with y"  is defined to be:           ifx+lx-1    z[i] =   sum    x[j]*y[i+j]  ;  i = ifz,...,ifz+lz-1            j=ifxThis function performs cross-correlation by(1) reversing the samples in the x array while copying    them to a temporary array, and(2) calling function conv() with ifx set to 1-ifx-lx.Assuming that the overhead of reversing the samples in x is negligible,this method enables cross-correlation to be performed as efficiently asconvolution, while reducing the amount of code that must be optimizedand maintained.******************************************************************************Author:  Dave Hale, Colorado School of Mines, 11/23/91*****************************************************************************//**************** end self doc ********************************/#include "cwp.h"void xcor (int lx, int ifx, float *x,	   int ly, int ify, float *y, 	   int lz, int ifz, float *z)/*****************************************************************************Compute z = x cross-correlated with y; i.e.,           ifx+lx-1    z[i] =   sum    x[j]*y[i+j]  ;  i = ifz,...,ifz+lz-1            j=ifx******************************************************************************Input:lx		length of x arrayifx		sample index of first xx		array[lx] to be cross-correlated with yly		length of y arrayify		sample index of first yy		array[ly] with which x is to be cross-correlatedlz		length of z arrayifz		sample index of first zOutput:z		array[lz] containing x cross-correlated with y******************************************************************************Notes:See notes for convolution function conv().This function performs cross-correlation by(1) reversing the samples in the x array while copying    them to a temporary array, and(2) calling function conv() with ifx set to 1-ifx-lx.Assuming that the overhead of reversing the samples in x is negligible,this method enables cross-correlation to be performed as efficiently asconvolution, while reducing the amount of code that must be optimizedand maintained.******************************************************************************Author:  Dave Hale, Colorado School of Mines, 11/23/91*****************************************************************************/{	int i,j;	float *xr;		xr = alloc1float(lx);	for (i=0,j=lx-1; i<lx; ++i,--j)		xr[i] = x[j];	conv(lx,1-ifx-lx,xr,ly,ify,y,lz,ifz,z);	free1float(xr);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -