Skip to content

ENH: real and complex dtype functions #13

@izaid

Description

@izaid

Hello! Very excited about this library, as it (hopefully) provides a place to put functions that are array agnostic and usable by many people. Let me describe two simple ones that I'd like to make a PR for.

I'd like to add functions real_type(dtype) and complex_type(dtype). These are simple:

  • real_type takes in a real or complex dtype, and returns the corresponding floating-point dtype. So complex128 -> float64, complex64 -> float32, float64 -> float64, float32 -> float32.
  • complex_type takes in a real or complex dtype, and returns the corresponding complex floating-point dtype. So float64 -> complex128, float32 -> complex64, complex128 -> complex128, complex64 -> complex64.

This can be really helpful in application code to work out the correct types. Shall I make a PR for these?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions