JavaCompilerCore/examples/bajo1_usecases/Matrix.jav

36 lines
561 B
Plaintext
Raw Normal View History

2013-10-18 11:33:46 +00:00
import java.util.Vector;
class Matrix extends Vector<Vector<Integer>> {
mul(m){
Vector<Vector<Integer>> ret;
ret = new Matrix();
i;
i = 0;
while(i <size()) {
v1;
v2;
v1 = this.elementAt(i);
v2 = new Vector<Integer>();
j;
j = 0;
while(j < v1.size()) {
erg;
erg = 0;
k;
k = 0;
while(k < v1.size()) {
erg = erg + v1.elementAt(k).intValue() * m.elementAt(k).elementAt(j).intValue();
k++;
}
v2.addElement(new Integer(erg));
j++;
}
ret.addElement(v2);
i++;
}
return ret;
}
}