public double det()
   throws Exception {
      if(_rows != _cols)
         throw new Exception("Matrix must be square to compute the determanent!");
      if(_rows == 2 && _cols == 2)
         return _det2x2();
      else if(_rows == 1 && _cols == 1)
         return _mat[0][0];
      else {
         double total = 0.0;
         Matrix temp;
         //int i2,j2;
         for(int ii = 0; ii < _cols; ii++) {
            temp = new Matrix(this);
            temp.removeRow(0);
            temp.removeCol(ii);
            total += (_mat[0][ii] * Math.pow(-1.0, (ii+1)+1) * temp.det());
         }
         return total;
      }
   }