I'm working on a program that does Gaussian Elimination. The input is supposed to be a double array with the dimensions of
[i+1], or [row][column]. The top loop only goes through twice and nothing changes. Any help as to what's going on will greatly help.
public double[][] solveForControlPoints(double[][] inputs){
//step 1
for(int i=0; i<inputs.length-1;i++){ <-- Error here @
System.out.println("Loop:" + i);
//part a
for(int o=i; o< inputs.length-1; o++){
inputs[i][o] = inputs[i][o] / inputs[i][i];
}
//part b
for(int o=i+1; o<inputs.length-1; o++){
double mult = -inputs[o][i];
for(int x=i; x<inputs.length-1; x++){
inputs[o][x] += mult * inputs[i][x];
}
}
}
//step 2
for(int i=inputs[1].length-2; i != -1; i--){
for(int x=i; x< inputs[i].length-2; x++){
inputs[i][inputs[1].length-1] -= (inputs[i][x] * inputs[x][inputs.length-1]);
}
}
return inputs;
}