public double Determinant(){
		double result = 0.0d;
		if (this.dim==1)
			return array[0][0];
		PMatrix SubMatrix = new PMatrix(this.dim-1);
		for(int i=0; i<this.dim; i++){ 
			for(int j=1; j<this.dim; j++){
				for(int k=0; k<this.dim; k++){
					if(k<i)
						SubMatrix.array[j-1][k] = array[j][k]; 
					else if(k>i)
						SubMatrix.array[j-1][k-1] = array[j][k]; 
				}
			}
			result += array[0][i] * Math.pow(-1, (double)i) * SubMatrix.Determinant(); 
		} 
		return result;	
	}