All Downloads are FREE. Search and download functionalities are using the official Maven repository.

termo.matrix.Matrix Maven / Gradle / Ivy

Go to download

Thermodynamics properties and equilibria calculations for chemical engineering.

There is a newer version: 3.5
Show newest version
package termo.matrix;

/**
 *
 * @author Hugo
 */
public class Matrix {
    protected double[][] matrix;
    public Matrix(double[][] matrix ){
        this.matrix = matrix;
    }
    
    public double a(int i , int j){
        return matrix[i-1][j-1];
    }
   
     public double determinant(){
        double result =0;
        
        if(matrix.length==1){
            result = a(1,1);
        }else{
            //determinante usando menores de la primer fila
            int firstRow =1;
            for(int col =1; col <= matrix.length; col++){
                double minor = menor(firstRow,col);
                result += a(firstRow,col) * minor;

            }
        }
        return result;
    }
    
    
    public double[][] cofactorMatrix(){
        double[][] cofactor = new double[matrix.length][matrix[0].length];
        
        
        for(int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy