Esempio n. 1
0
 public static RInt double2int(
     RDouble value, ConversionStatus warn) { // eager to keep error semantics eager
   int size = value.size();
   int[] content = new int[size];
   for (int i = 0; i < size; i++) {
     double d = value.getDouble(i);
     content[i] = Convert.double2int(d, warn);
   }
   return RInt.RIntFactory.getFor(content, value.dimensions(), value.names());
 }
Esempio n. 2
0
 public static RRaw doubleToRaw(
     RDouble value, ConversionStatus warn) { // eager to keep error semantics eager
   int size = value.size();
   byte[] content = new byte[size];
   for (int i = 0; i < size; i++) {
     double dval = value.getDouble(i);
     content[i] = Convert.double2raw(dval, warn);
   }
   return RRaw.RRawFactory.getFor(content, value.dimensions(), value.names());
 }
Esempio n. 3
0
 public static RDouble copy(RDouble d) {
   if (d.size() == 1 && d.dimensions() == null && d.names() == null && d.attributes() == null) {
     return new ScalarDoubleImpl(d.getDouble(0));
   }
   return new DoubleImpl(d, false);
 }