Skip to content

Add Conversions methods to Vector<T> #14521

@CarolEidt

Description

@CarolEidt

It would be useful to support conversions between different types of Vector. The API and usage model is pretty straightforward for same-size types, e.g. Double and Int64, so I would suggest that we start by exposing that, and consider mixed-size converts as usage demands (we have had customer requests for at least the same-size convert). A possible instance method on Vector might look like this:
public Vector ToVectorDouble();
and it would throw arg exception for non-64-bit vectors (or, alternatively, it could be defined as an extension method on the static Vector class for only those instantiations that are supported).

I propose the following:

  • Vector<Double> <=> Vector<Int64>
  • Vector<Double> <=> Vector<UInt64>
  • Vector<Single> <=> Vector<Int32>
  • Vector<Single> <=> Vector<UInt32>

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-needs-workAPI needs work before it is approved, it is NOT ready for implementationarea-System.Numericshelp wanted[up-for-grabs] Good issue for external contributors

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions