well,here is my doubt i am working on pivot method of matrix.Each time i have to get the pivot element by different condition,although the condition is same that (i==j) in a for loop,i have to do this bcoz column go on incrementing.
Below shown is my code,here in the code what i am actualy trying to do is...as i==j "condition 1" gets executed again the execution must go to the top and next time if i==j than condition 2 must get executed and so on,but i dont know where i am wrong
what happens actualy is the first time when i==j the value which i get that value is used through out my program thats why each time i have to put condition for i or j so as to get the next pivot element.
What i must do in the for loop so as to get the next pivot element each time .
I am realy stuck into it
But if i want to work on 50-100 matrix than the code will become larger so if any solution for my problem ,the advice is most welcome.
public void operation1(Matr I) throws NumberFormatException, IOException
{
Matr A=this;
double d1=0;
double d2=0;
double d3=0;
for(i=0;i<1;i++)
{
for(j=0;j<N;j++)
{
if(i==j)
{
d1=A.data[i][j];
}
I.data[i][j]=(I.data[i][j]/d1);
A.data[i][j]=(A.data[i][j]/d1);
}
}
refresh(A);
for(i=1;i<M;i++)
{
for(j=N-1;j>=0;j--)
{
I.data[i][j]=(I.data[i][j]-(A.data[i][j-j]*I.data[i-i][j]));
A.data[i][j]=(A.data[i][j]-(A.data[i][j-j]*A.data[i-i][j]));
}
}
refresh(A);
for(i=1;i<2;i++)
{
for(j=0;j<N;j++)
{
if(i==j)
{
d2=A.data[i][j];
}
}
}
for(i=1;i<2;i++)
{
for(j=0;j<N;j++)
{
I.data[i][j]=(I.data[i][j]/d2);
A.data[i][j]=(A.data[i][j]/d2);
}
}
refresh(A);
//this is condition 1
for(i=0;i<1;i++)
{
for(j=0;j<N;j++)
{
if(j>i)
{
d3=A.data[i][j];
}
}
for(i=0;i<1;i++)
{
for(j=0;j<N;j++)
{
I.data[i][j]=(I.data[i][j]-(d3*I.data[i+(j-(j-1))][j]));
A.data[i][j]=(A.data[i][j]-(d3*A.data[i+(j-(j-1))][j]));
}
}
}
//this is condition 2
for(i=2;i<M;i++)
{
for(j=0;j<N;j++)
{
if(j!=1)
{
I.data[i][j]=(I.data[i][j]-(A.data[i][j-(j-1)]*I.data[i-(i-1)][j]));
A.data[i][j]=(A.data[i][j]-(A.data[i][j-(j-1)]*A.data[i-(i-1)][j]));
}
}
}
for(i=2;i<M;i++)
{
for(j=0;j<N;j++)
{
if(j==1)
{
I.data[i][j]=(I.data[i][j]-(A.data[i][j-(j-1)]*I.data[i-(i-1)][j]));
A.data[i][j]=(A.data[i][j]-(A.data[i][j-(j-1)]*A.data[i-(i-1)][j]));
}
}
}
refresh(A);