Skip to content

Instantly share code, notes, and snippets.

@rossGardiner
Created March 10, 2015 19:45
Show Gist options
  • Save rossGardiner/346e58f37371fd3081b8 to your computer and use it in GitHub Desktop.
Save rossGardiner/346e58f37371fd3081b8 to your computer and use it in GitHub Desktop.
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