28 lines
511 B
Java
28 lines
511 B
Java
import java.util.Vector;
|
|
import java.lang.Integer;
|
|
import java.lang.Float;
|
|
//import java.lang.Byte;
|
|
//import java.lang.Boolean;
|
|
|
|
public class Scalar extends Vector<Integer> {
|
|
|
|
public Scalar(v) {
|
|
Integer i;
|
|
i = 0;
|
|
while(i < v.size()) {
|
|
this.add(v.elementAt(i));
|
|
i=i+1;
|
|
}
|
|
}
|
|
|
|
public mul(v) {
|
|
var ret = 0;
|
|
var i = 0;
|
|
while(i < size()) {
|
|
ret = ret + this.elementAt(i) * v.elementAt(i);
|
|
i = i+1;
|
|
}
|
|
return ret;
|
|
}
|
|
}
|