code: public static DoubleVector asDouble(Vector v) {
          if (v == null)
              throw new NullPointerException("Cannot re-type a null vector");
          // NOTE: Special case the the sparse classes first to becase the
          // base interfaces of DoubleVectors and IntegerVectors matches as well.
          if (v instanceof SparseIntegerVector)
              return new IntAsSparseDoubleVector((SparseIntegerVector)v);
          if (v instanceof SparseDoubleVector)
              return (SparseDoubleVector) v;
          else if (v instanceof IntegerVector)
              return new IntAsDoubleVector((IntegerVector)v);
          else if (v instanceof DoubleVector)
              return (DoubleVector)v;
          // Base case: the vector is either of some unknown type or only
          // implements Vector.  Therefore, wrap its contents using Vector's API.
          else
              return new ViewVectorAsDoubleVector(v);
      }
docs: Returns a view over the given {@code Vector} as a {@code DoubleVector}.
  The returned vector is mutable but any changes will be converted into its
  internal data-type, e.g. {@code int}, which may result in information
  loss.
  
  @param v The {@code Vector} to return as a {@code DoubleVector}.
  
  @return a mutable {@code DoubleVector} view of {@code v}