2018-09-11 19:59:20 +00:00
|
|
|
import java.util.Vector;
|
|
|
|
import java.lang.Integer;
|
2019-05-10 19:23:28 +00:00
|
|
|
//import java.lang.Byte;
|
2018-09-11 19:59:20 +00:00
|
|
|
import java.lang.Boolean;
|
|
|
|
|
2019-03-28 14:44:03 +00:00
|
|
|
public class MatrixOP extends Vector<Vector<Integer>> {
|
2018-09-11 19:59:20 +00:00
|
|
|
|
2018-10-04 22:23:04 +00:00
|
|
|
MatrixOP () {
|
2018-09-11 19:59:20 +00:00
|
|
|
}
|
|
|
|
|
2024-03-14 12:50:56 +00:00
|
|
|
public MatrixOP(vv) {
|
2018-09-11 19:59:20 +00:00
|
|
|
Integer i;
|
|
|
|
i = 0;
|
|
|
|
while(i < vv.size()) {
|
|
|
|
// Boolean a = this.add(vv.elementAt(i));
|
|
|
|
this.add(vv.elementAt(i));
|
|
|
|
i=i+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-18 11:17:50 +00:00
|
|
|
public mul = (m1, m2) -> {
|
2018-10-04 22:23:04 +00:00
|
|
|
var ret = new MatrixOP();
|
2018-09-11 19:59:20 +00:00
|
|
|
var i = 0;
|
2019-02-27 15:04:55 +00:00
|
|
|
while(i < m1.size()) {
|
2018-09-11 19:59:20 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|