Skip to content

A few starter generic compute kernels #254

Description

@mobiusklein

Describe the enhancement requested

I have been hand-writing a pile of generic kernels for numerical arrays and wanted to know what would be required to contribute them upstream.

So far I have implementations for:

  • public static Array Filter(Array array, BooleanArray mask)
  • public static BooleanArray Equal<T>(PrimitiveArray<T> lhs, T rhs) where T: struct, INumber<T>
  • public static BooleanArray Equal<T>(PrimitiveArray<T> lhs, PrimitiveArray<T> rhs) where T: struct, INumber<T>
  • public static Array Take(Array array, IList<int> indices)
  • public static Int64Array CastInt64<T>(PrimitiveArray<T> array) where T: struct, INumber<T>
  • public static Int32Array CastInt32<T>(PrimitiveArray<T> array) where T : struct, INumber<T>
  • public static FloatArray CastFloat<T>(PrimitiveArray<T> array) where T : struct, INumber<T>
  • public static DoubleArray CastDouble<T>(PrimitiveArray<T> array) where T : struct, INumber<T>

I also have a generic visitor for converting Large* arrays to their regular counterparts so that they may work with the other machinery in the library. I am less confident that is useful to others, or that it is truly correct.

Is there a particular pattern you would want these to follow or is the notion not suitable for the .NET ecosystem? I am less familiar with .NET as an ecosystem.

Thank you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions