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