@@ -0,0 +1,1779 @@
+package org.openlca.julia;%0A%0Aimport org.openlca.core.matrix.format.DenseMatrix;%0Aimport org.openlca.core.matrix.format.IMatrix;%0Aimport org.openlca.core.matrix.format.MatrixConverter;%0Aimport org.openlca.core.matrix.solvers.IMatrixSolver;%0A%0Apublic class JuliaDenseSolver implements IMatrixSolver %7B%0A%0A%09@Override%0A%09public IMatrix matrix(int rows, int columns) %7B%0A%09%09return new DenseMatrix(rows, columns);%0A%09%7D%0A%0A%09@Override%0A%09public double%5B%5D solve(IMatrix a, int idx, double d) %7B%0A%09%09DenseMatrix A = MatrixConverter.asDenseMatrix(a);%0A%09%09DenseMatrix lu = A.copy();%0A%09%09double%5B%5D b = new double%5Ba.rows()%5D;%0A%09%09b%5Bidx%5D = d;%0A%09%09Julia.solve(A.columns(), 1, lu.getData(), b);%0A%09%09return b;%0A%09%7D%0A%0A%09@Override%0A%09public double%5B%5D multiply(IMatrix m, double%5B%5D x) %7B%0A%09%09DenseMatrix a = MatrixConverter.asDenseMatrix(m);%0A%09%09double%5B%5D y = new double%5Bm.rows()%5D;%0A%09%09Julia.mvmult(m.rows(), m.columns(), a.getData(), x, y);%0A%09%09return y;%0A%09%7D%0A%0A%09@Override%0A%09public DenseMatrix invert(IMatrix a) %7B%0A%09%09DenseMatrix _a = MatrixConverter.asDenseMatrix(a);%0A%09%09DenseMatrix i = _a.copy();%0A%09%09Julia.invert(_a.columns(), i.getData());%0A%09%09return i;%0A%09%7D%0A%0A%09@Override%0A%09public DenseMatrix multiply(IMatrix a, IMatrix b) %7B%0A%09%09DenseMatrix _a = MatrixConverter.asDenseMatrix(a);%0A%09%09DenseMatrix _b = MatrixConverter.asDenseMatrix(b);%0A%09%09int rowsA = _a.rows();%0A%09%09int colsB = _b.columns();%0A%09%09int k = _a.columns();%0A%09%09DenseMatrix c = new DenseMatrix(rowsA, colsB);%0A%09%09if (colsB == 1)%0A%09%09%09Julia.mvmult(rowsA, k, _a.getData(), _b.getData(), c.getData());%0A%09%09else%0A%09%09%09Julia.mmult(rowsA, colsB, k, _a.getData(), _b.getData(),%0A%09%09%09%09%09c.getData());%0A%09%09return c;%0A%09%7D%0A%0A%09@Override%0A%09public void scaleColumns(IMatrix m, double%5B%5D v) %7B%0A%09%09for (int row = 0; row %3C m.rows(); row++) %7B%0A%09%09%09for (int col = 0; col %3C m.columns(); col++) %7B%0A%09%09%09%09m.set(row, col, v%5Bcol%5D * m.get(row, col));%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

implement solver interface for dense matrices