First, please don't say rude comments, I started java two months ago with no programming experience at all. My question is how to write a transpose problem where it prints the values diagonally.I already have the code done for the transpose part but I am not sure how to add on a new matrix so that I can make my numerical values print out in a diagonal order.I get that I make a new matrix but I don't know how to begin. Here is the code:
public static double[][] transpose(double[][] A) {
for (int i = 0; i < A.length; i++) {
for (int j = i+1; j < A[0].length; j++) {
double temp = A[i][j];
A[i][j] = A[j][i];
A[j][i] = temp;
}
}
return A;
}
Should I add another similar matrix?
Thanks
Aucun commentaire:
Enregistrer un commentaire