JavaCompilerCore/resources/javFiles/Matrix.jav

29 lines
901 B
Plaintext
Raw Permalink Normal View History

2017-08-28 13:42:51 +00:00
import java.util.Vector;
2018-01-31 12:34:54 +00:00
import java.lang.Integer;
2017-08-28 13:42:51 +00:00
2017-11-03 12:56:04 +00:00
class Matrix extends Vector<Vector<Integer>> {
Integer mul1(Integer x, Integer y) { return x;}
Integer add1(Integer x, Integer y) { return x;}
mul(m) {
var ret = new Matrix();
var i = 0;
2018-02-07 15:53:24 +00:00
while(i < size()) {
var v1 = this.elementAt(i);
2018-02-07 15:53:24 +00:00
var v2 = new Vector<Integer>();
var j = 0;
while(j < v1.size()) {
var erg = 0;
var k = 0;
while(k < v1.size()) {
2018-07-04 10:07:11 +00:00
erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j);
//erg = add1(erg, mul1(v1.elementAt(k),
// m.elementAt(k).elementAt(j)));
k++; }
v2.addElement(new Integer(erg));
2018-02-07 15:53:24 +00:00
j++; }
ret.addElement(v2);
i++; }
return ret;
}
2017-11-03 12:56:04 +00:00
}