M
mohi
hello everyone,
i use a function called minor to find the minor of an element of a
matrix ,
i declare it as :
float minor(float A[ ][COL],int m,int n,int i,int j);//find the minor
in A[][]
and define it later in the file as :
float minor(float A[][COL],int m,int n,int i,int j)
{
if(m==0 ||n==0)//single coloumn or single row
return 1.0;
float temp[ROW][COL];//temp matrix used to find mod (will have one row
and \
//less than the parent matrix
int p,p1,q,q1;//indexes
for(p=0,p1=0;p<=m&& p1<=(m-1);p++,p1++){
if(p==i){
p1--;
continue;//ignore row i
}
for(q=0,q1=0;q<=n && q1<=(n-1);q++,q1++){
if(q==j){
q1--;
continue;//ignore coloumn j
}
temp[p1][q1]=A[p][q];
}
}
float x= mod(temp,m-1,n-1);//return the determinant of temp
return x;
}
when i compile it using gnu g++ it gives the following error :
solve_equation.cpp:13:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:68:49: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:76:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:121:51: error: macro "minor" passed 5 arguments,
but takes just 1
solve_equation.cpp:76: error: invalid function declaration
as it seems the compiler is taking function minor() as macro .....
but why???
and how is the function declaration invalid??
i use gnu g++ on fedora c8........
thank you
mohan gupta
i use a function called minor to find the minor of an element of a
matrix ,
i declare it as :
float minor(float A[ ][COL],int m,int n,int i,int j);//find the minor
in A[][]
and define it later in the file as :
float minor(float A[][COL],int m,int n,int i,int j)
{
if(m==0 ||n==0)//single coloumn or single row
return 1.0;
float temp[ROW][COL];//temp matrix used to find mod (will have one row
and \
//less than the parent matrix
int p,p1,q,q1;//indexes
for(p=0,p1=0;p<=m&& p1<=(m-1);p++,p1++){
if(p==i){
p1--;
continue;//ignore row i
}
for(q=0,q1=0;q<=n && q1<=(n-1);q++,q1++){
if(q==j){
q1--;
continue;//ignore coloumn j
}
temp[p1][q1]=A[p][q];
}
}
float x= mod(temp,m-1,n-1);//return the determinant of temp
return x;
}
when i compile it using gnu g++ it gives the following error :
solve_equation.cpp:13:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:68:49: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:76:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:121:51: error: macro "minor" passed 5 arguments,
but takes just 1
solve_equation.cpp:76: error: invalid function declaration
as it seems the compiler is taking function minor() as macro .....
but why???
and how is the function declaration invalid??
i use gnu g++ on fedora c8........
thank you
mohan gupta