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>> {
|
2018-03-13 07:46:25 +00:00
|
|
|
Integer mul1(Integer x, Integer y) { return x;}
|
2018-03-14 16:48:04 +00:00
|
|
|
Integer add1(Integer x, Integer y) { return x;}
|
2018-01-30 00:08:21 +00:00
|
|
|
mul(m) {
|
|
|
|
var ret = new Matrix();
|
|
|
|
var i = 0;
|
2018-02-07 15:53:24 +00:00
|
|
|
while(i < size()) {
|
2018-01-30 00:08:21 +00:00
|
|
|
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()) {
|
2018-02-14 16:45:08 +00:00
|
|
|
var erg = 0;
|
|
|
|
var k = 0;
|
2018-02-21 13:02:48 +00:00
|
|
|
while(k < v1.size()) {
|
2018-07-02 15:24:16 +00: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 13:02:48 +00:00
|
|
|
k++; }
|
|
|
|
v2.addElement(new Integer(erg));
|
2018-02-07 15:53:24 +00:00
|
|
|
j++; }
|
|
|
|
ret.addElement(v2);
|
|
|
|
i++; }
|
2018-01-30 00:08:21 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2017-11-03 12:56:04 +00:00
|
|
|
}
|