@Builtin("as.double")
public static DoubleVector asDouble(Vector source) {
if(source instanceof DoubleVector) {
return (DoubleVector) source.setAttributes(AttributeMap.EMPTY);
} else if(source instanceof DeferredComputation || source.length() > 100) {
return new ConvertingDoubleVector(source);
} else {
return (DoubleVector) convertToAtomicVector(new DoubleArrayVector.Builder(), source);
}
}