Skip to content
Snippets Groups Projects
Commit 790aca53 authored by fefe's avatar fefe
Browse files

Add matrix to the project

parent c0d9db78
Branches
Tags
No related merge requests found
package ch.hepia.numeric;
import java.util.List;
import java.util.ArrayList;
import java.util.function.BiFunction;
import java.util.function.DoubleFunction;
public class Matrix {
public int nbRows() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public int nbCols() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public List<Vector> cols() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public List<Transposed> rows() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Transposed getRow(int i) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Vector getCol(int i) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public double get(int i, int j) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
void set(int row, int col, double value) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Matrix map(DoubleFunction<Double> f) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Matrix add(Matrix that) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Matrix mul(double d) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Matrix mul(Matrix that) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Matrix sub(Matrix that) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public boolean isSquare() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Matrix t() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Matrix rowRemoved(int i){
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Matrix colRemoved(int i){
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Matrix removed(int i, int j) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public Matrix adjugate() {
Matrix res = Matrix.tabulate(nbRows(), nbCols(), (i, j) -> {
if ((i + j) % 2 == 0) {
return removed(i, j).det();
} else {
return -removed(i, j).det();
}
});
return res;
}
public Matrix inv() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public double det() {
if (!isSquare()) {
/* do something smart */
}
if( nbCols() == 1) {
return get(0,0);
} else if( nbCols() == 2 ){
return get(0,0)*get(1,1) - get(1,0)*get(0,1);
} else {
/* A vous de jouer */
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
}
public Matrix copy() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
@Override
public String toString() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
@Override
public boolean equals(Object obj) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Matrix of(List<Transposed> ts) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Matrix of(Transposed... ts) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Matrix empty() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Matrix fill(int rows, int cols, double value) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Matrix zeros(int rows, int cols) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Matrix ones(int rows, int cols) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Matrix tabulate(int rows, int cols, BiFunction<Integer, Integer, Double> f) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Matrix diag(double... ds) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Matrix identity(int nb) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Vector solve(Matrix m, Vector b) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment