Skip to content

Update guidance concerning mixing arrays with Python scalars to handle complex - #513

Merged
rgommers merged 1 commit into
mainfrom
cmplx-mixing-arrays-scalars
Nov 21, 2022
Merged

Update guidance concerning mixing arrays with Python scalars to handle complex#513
rgommers merged 1 commit into
mainfrom
cmplx-mixing-arrays-scalars

Conversation

@kgryte

Copy link
Copy Markdown
Contributor

This PR

  • updates the guidance concerning mixing arrays with Python scalars. The current specification accommodates bool and real-valued data types. This PR updates the guidance to accommodate mixing a complex Python scalar with arrays. Guidance is intentionally limited to when a scalar is complex and an array has a complex floating-point array data type.
  • does not specify what happens when a scalar is complex and an array has a real-valued array data type. Behavior is left implementation-specific (e.g., promotion, exception, etc). Given that current guidance requires converting a scalar to the array data type, to accommodate complex scalars and real-valued arrays, we'd need to specify casting rules for complex to real, which is something the specification has thus far avoided (e.g., astype, real, imag, conj, et al). This PR aims to be consistent with those prior decisions.

@kgrytekgryte added Narrative Content Narrative documentation content. topic: Complex Data Types Complex number data types. topic: Type Promotion Type promotion. labels Nov 21, 2022
@kgrytekgryte added this to the v2022 milestone Nov 21, 2022

@rgommersrgommers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks logical and straightforward to me, so I'll merge it. Thanks @kgryte

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

Labels

Narrative ContentNarrative documentation content.topic: Complex Data TypesComplex number data types.topic: Type PromotionType promotion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@kgryte@rgommers