forked from JavaTX/JavaCompilerCore
44 lines
1.0 KiB
Java
44 lines
1.0 KiB
Java
import java.util.Vector;
|
|
import java.lang.Integer;
|
|
//import java.lang.Byte;
|
|
import java.lang.Boolean;
|
|
|
|
public class MatrixOP extends Vector<Vector<Integer>> {
|
|
|
|
MatrixOP () {
|
|
}
|
|
|
|
public MatrixOP(vv) {
|
|
Integer i;
|
|
i = 0;
|
|
while(i < vv.size()) {
|
|
// Boolean a = this.add(vv.elementAt(i));
|
|
this.add(vv.elementAt(i));
|
|
i=i+1;
|
|
}
|
|
}
|
|
|
|
public mul = (m1, m2) -> {
|
|
var ret = new MatrixOP();
|
|
var i = 0;
|
|
while(i < m1.size()) {
|
|
var v1 = m1.elementAt(i);
|
|
var v2 = new Vector<Integer>();
|
|
var j = 0;
|
|
while(j < v1.size()) {
|
|
var erg = 0;
|
|
var k = 0;
|
|
while(k < v1.size()) {
|
|
erg = erg + v1.elementAt(k)
|
|
* m2.elementAt(k).elementAt(j);
|
|
k++; }
|
|
// v2.addElement(new Integer(erg));
|
|
v2.addElement(erg);
|
|
j++; }
|
|
ret.addElement(v2);
|
|
i++;
|
|
}
|
|
return ret;
|
|
};
|
|
}
|