2024-05-08 09:07:22 +02:00
|
|
|
import java.util.List;
|
2024-05-10 14:16:23 +02:00
|
|
|
import java.util.AbstractList;
|
2018-03-18 16:08:52 +01:00
|
|
|
import java.util.Vector;
|
|
|
|
import java.lang.Integer;
|
2023-04-04 15:54:03 +02:00
|
|
|
//import java.lang.Float;
|
2018-07-18 17:01:01 +02:00
|
|
|
//import java.lang.Byte;
|
2018-11-05 23:28:08 +01:00
|
|
|
//import java.lang.Boolean;
|
2018-03-18 16:08:52 +01:00
|
|
|
|
2019-03-19 16:31:04 +01:00
|
|
|
public class Matrix extends Vector<Vector<Integer>> {
|
2018-07-10 22:15:26 +02:00
|
|
|
|
|
|
|
Matrix () {
|
|
|
|
}
|
|
|
|
|
2024-03-14 13:50:56 +01:00
|
|
|
public Matrix(vv) {
|
2018-07-18 17:01:01 +02:00
|
|
|
Integer i;
|
|
|
|
i = 0;
|
2018-07-10 22:15:26 +02:00
|
|
|
while(i < vv.size()) {
|
|
|
|
// Boolean a = this.add(vv.elementAt(i));
|
|
|
|
this.add(vv.elementAt(i));
|
|
|
|
i=i+1;
|
2019-03-17 17:44:09 +01:00
|
|
|
}
|
2018-07-10 22:15:26 +02:00
|
|
|
}
|
|
|
|
|
2024-03-14 13:50:56 +01:00
|
|
|
public mul(m) {
|
2018-03-18 16:08:52 +01:00
|
|
|
var ret = new Matrix();
|
|
|
|
var i = 0;
|
|
|
|
while(i < size()) {
|
2018-06-13 15:50:05 +02:00
|
|
|
var v1 = this.elementAt(i);
|
2018-07-04 22:18:16 +02:00
|
|
|
var v2 = new Vector<Integer>();
|
|
|
|
var j = 0;
|
|
|
|
while(j < v1.size()) {
|
|
|
|
var erg = 0;
|
|
|
|
var k = 0;
|
|
|
|
while(k < v1.size()) {
|
2024-05-02 00:13:45 +02:00
|
|
|
erg = erg + v1.get(k)
|
|
|
|
* m.get(k).get(j);
|
2018-07-04 22:18:16 +02:00
|
|
|
k++; }
|
2018-07-10 22:15:26 +02:00
|
|
|
// v2.addElement(new Integer(erg));
|
2018-07-04 22:18:16 +02:00
|
|
|
v2.addElement(erg);
|
|
|
|
j++; }
|
|
|
|
ret.addElement(v2);
|
|
|
|
i++;
|
2018-03-18 16:08:52 +01:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|