Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Bcast object-ified broacasting rules #280

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft

Introduce Bcast object-ified broacasting rules #280

wants to merge 29 commits into from

Conversation

inducer
Copy link
Owner

@inducer inducer commented Aug 25, 2024

See discussion in #190 for context, where this was fairly controversial.

inducer and others added 28 commits August 25, 2024 15:32
Passing both 'bcast_numpy_array' and '_bcast_actx_array_types' was
ill-defined. For example, in the case of an ArrayContext whose thawed
array type is np.ndarray the specification would contradict between
broadcasting the argument numpy_array to return an object array *OR*
peforming the operation with every leaf array.

Consider the example below,

(
- 'Foo: ArrayContainer' whose arithmetic routines are
   generated by `with_container_arithmetic(bcast_numpy=True,
   _bcast_actx_array_types=True)`
- 'actx: ArrayContextT' for whom `np.ndarray` is a valid thawed array
   type.
)

Foo(DOFArray(actx, [38*actx.ones(3, np.float64)])) + np.array([3, 4, 5])
could be either of:
- array([Foo(DOFArray([array([41, 41, 41])])),
         Foo(DOFArray([array([42, 42, 42])])),
         Foo(DOFArray([array([43, 43, 43])]))]), OR,
- Foo(DOFArray(actx, array([41, 42, 43])))
- Deprecate automatic broadcasting of array context arrays
- Introduce Bcast as an object to represent broadcast rules
- Warn about uses of numpy array broadcasting, deprecated earlier
- Clarify documentation, warning wording
@inducer inducer force-pushed the numpy-rebased branch 2 times, most recently from dfc08cd to bc323fc Compare September 4, 2024 20:17
Base automatically changed from numpy-rebased to main September 4, 2024 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants