コード例 #1
0
 @Override
 public void sum(Vector v) throws IncompatibleVectorSizesException {
   if (v.getSize() != adaptee.size()) {
     throw new IncompatibleVectorSizesException();
   }
   for (int i = 0; i < adaptee.size(); i++) {
     setElement(i, getElement(i) * v.getElement(i));
   }
 }
コード例 #2
0
 @Override
 public void fillFromVector(Vector v) {
   adaptee.clear();
   double[] arr = new double[v.getSize()];
   for (int i = 0; i < v.getSize(); i++) {
     arr[i] = v.getElement(i);
   }
   adaptee.addAll(Arrays.asList(arr));
 }