Created
March 10, 2015 19:45
-
-
Save rossGardiner/346e58f37371fd3081b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SquareMatrix extends Matrix | |
{ | |
private int order; | |
/** | |
* constructor for class SquareMatrix | |
* @param n | |
*/ | |
public SquareMatrix(int n) | |
{ | |
super(n,n); | |
this.setOrder(n); | |
} | |
/** | |
* returns the transpose of the matrix | |
* @param mat | |
* @return | |
*/ | |
public double[][] matrixTranspose(double [][] mat) | |
{ | |
mat = new double[this.getRows()][this.getColumns()]; | |
for (int i1 = 0; i1 < this.getColumns(); i1++) | |
{ | |
for(int j1 = 0; j1 < this.getRows(); j1++) | |
{ | |
mat[i1][j1] = this.getAMatrixValue(j1, i1); | |
} | |
} | |
return mat; | |
} | |
public int getOrder() | |
{ | |
return this.order; | |
} | |
public void setOrder(int n) | |
{ | |
this.order = n; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment