vioravis
March 20th, 2007, 01:08 AM
I am trying to write a function for matrix multiplication when the two matrices are of type complex.
void MatMultMatCmpx(int q,cmplx **M1, int r,cmplx **M2, int s, cmplx **M)
{
int i,j,k;
for (i=0;i<q;i++)
for (j=0;j<s;j++) {
M[i][j] = 0.0;
for (k=0;k<r;k++)
{
M[i][j] += M1[i][k] * M2[k][j];
}
}
}
I am getting the following errors:
error C2061: syntax error : identifier 'cmplx' matrix.h(125) : error C2061: syntax error : identifier 'cmplx'
matrix.cpp(1326) : error C2061: syntax error : identifier 'cmplx'
matrix.cpp(1331) : error C2065: 's' : undeclared identifier
matrix.cpp(1332) : error C2065: 'M' : undeclared identifier
matrix.cpp(1340) : error C2065: 'M1' : undeclared identifier
matrix.cpp(1340) : error C2065: 'M2' : undeclared identifier
qcorral.cpp(681) : error C2664: 'MatMultMatCmpx' : cannot convert parameter 2 from 'dynamic_2d_array<T>' to 'cmplx **'
1> with
1> [
1> T=cmplx
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
There is already a function in the same .cpp file for multiplying real matrices. Can someone please let me know how do I get this to work for complex matrices? Thanks.
void MatMultMatCmpx(int q,cmplx **M1, int r,cmplx **M2, int s, cmplx **M)
{
int i,j,k;
for (i=0;i<q;i++)
for (j=0;j<s;j++) {
M[i][j] = 0.0;
for (k=0;k<r;k++)
{
M[i][j] += M1[i][k] * M2[k][j];
}
}
}
I am getting the following errors:
error C2061: syntax error : identifier 'cmplx' matrix.h(125) : error C2061: syntax error : identifier 'cmplx'
matrix.cpp(1326) : error C2061: syntax error : identifier 'cmplx'
matrix.cpp(1331) : error C2065: 's' : undeclared identifier
matrix.cpp(1332) : error C2065: 'M' : undeclared identifier
matrix.cpp(1340) : error C2065: 'M1' : undeclared identifier
matrix.cpp(1340) : error C2065: 'M2' : undeclared identifier
qcorral.cpp(681) : error C2664: 'MatMultMatCmpx' : cannot convert parameter 2 from 'dynamic_2d_array<T>' to 'cmplx **'
1> with
1> [
1> T=cmplx
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
There is already a function in the same .cpp file for multiplying real matrices. Can someone please let me know how do I get this to work for complex matrices? Thanks.