📄 fkroni.c
字号:
/*****************************************************/
/*FkronI */
/*Maritza Rodr韌uez Mart韓ez */
/*Computational Signal Processing Group - march-98 */
/*CSPG - Dr. Domingo Rodr韌uez - Coordinator */
/* */
/*Description: */
/*This function fkroni performs the product between */
/*the tensor product of matrices FR and IS, where FR*/
/*is the Fourier matrix of order R, and IS is the */
/*identity matix of order S. */
/*****************************************************/
COMPLEX **FkronI(int R,int S)
{
COMPLEX **A;
COMPLEX **B;
COMPLEX **FkronI_VAR;
int temp,l=0,m,k,i,j;
A = getComplexMatrix(R);
B = getComplexMatrix(S);
FkronI_VAR = getComplexMatrix(R*S);
/* crea la matriz Is */
for(l=0; l <S ; ++l)
for(m=0; m <S ; ++m)
if(m==l){
B[l][m].real=1.0;
B[l][m].imag=0.0;
}
else{
B[l][m].real =0;
B[l][m].imag=0;
}
/* crea la matriz Fr*/
for(l=0; l < R ; ++l)
for(m=0; m < R ; ++m)
if(l==0 || m==0){
A[l][m].real=1.0;
A[l][m].imag=0.0;
}
else{
A[l][m].real=cos((-2*PI*l*m)/R);
A[l][m].imag=-sin((-2*PI*l*m)/R);
}
l=0;
for(m=0; m<(R*S); ++m) /* este es el valor de filas *columnas*/
{
k=0;
if (m % S ==0 & m!=0 ) /* el valor para comparar m debe ser el num de columnas de B*/
l++;
temp =R;
for ( i=0; i < temp; ++i)/* numero de filas o columnas mayor entre A y B*/
{
for ( j=0; j < S; ++j)/* numero de filas o columnas de B*/
{
FkronI_VAR[m][k].real = A[l%R][i].real * B[m % S][j].real; /* m%filas o columnas de B*/
FkronI_VAR[m][k].imag = A[l%R][i].imag * B[m % S][j].imag; /* m%filas o columnas de B*/
k++;
}
}
}
free(A);
free(B);
return FkronI_VAR;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -