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

DiscreteLp.element() more strict on input shape? #856

Closed
kohr-h opened this issue Jan 23, 2017 · 2 comments
Closed

DiscreteLp.element() more strict on input shape? #856

kohr-h opened this issue Jan 23, 2017 · 2 comments

Comments

@kohr-h
Copy link
Member

kohr-h commented Jan 23, 2017

When switching from flat to multi-dimensional storage, how do we want to deal with flat input to DiscreteLp.element?

While being "hybrid" in the sense that storage was linear but outer appearance was multi-dim. for DiscreteLpElement's, it made sense to support any kind of data with the right size.

Do we want to abandon this? I think it has some potential for bugs, for example

  • Why would it make sense to allow input of arbitrary shape that happens to match the size of the space?
    >>> space = odl.uniform_discr([0, 0], [1, 1], (2, 12))
    >>> arr = np.ones((2, 3, 4))
    >>> space.element(arr)  # works, WTF??
  • Easy to mess up with C vs. F ordering. It's not simple to get right with explicit reshaping either, but at least you have a chance to get it right.
  • Numpy has a stricter policy, sizes must be broadcastable upon assignment, which is kind of what happens here.

My suggestion is to allow only broadcastable shapes as input.

@adler-j
Copy link
Member

adler-j commented Jan 23, 2017

This is related to #568.

kohr-h pushed a commit that referenced this issue Nov 4, 2017
Closes: #225, #342, #856, #964, #1085

Details:

- Implement multi-indexing of ODL vectors
- Implement tensor-valued `FunctionSpaceElement` using a
  numpy.dtype with shape
- Implement __array_ufunc__ interface for tensors and DiscreteLpElement
- Remove `order` from spaces, add to `element` instead
- Allow Numpy 1.13
- Rewrite documentation
- Rename `uspace` and `dspace` to `fspace` and `tspace`,
  respectively.
- Move fn_ops code to tensor_ops
- Implement `MatrixOperator` for multiple axes
- Allow `field=None` in LinearSpace
- Remove local Numpy compat code
- Adapt tests
- Simplify pytest fixtures
kohr-h pushed a commit that referenced this issue Nov 11, 2017
Closes: #225, #342, #856, #964, #1085

Details:

- Implement multi-indexing of ODL vectors
- Implement tensor-valued `FunctionSpaceElement` using a
  numpy.dtype with shape
- Implement __array_ufunc__ interface for tensors and DiscreteLpElement
- Remove `order` from spaces, add to `element` instead
- Allow Numpy 1.13
- Rewrite documentation
- Rename `uspace` and `dspace` to `fspace` and `tspace`,
  respectively.
- Move fn_ops code to tensor_ops
- Implement `MatrixOperator` for multiple axes
- Allow `field=None` in LinearSpace
- Remove local Numpy compat code
- Adapt tests
- Simplify pytest fixtures
kohr-h pushed a commit that referenced this issue Nov 13, 2017
Closes: #225, #342, #856, #964, #1085

Details:

- Implement multi-indexing of ODL vectors
- Implement tensor-valued `FunctionSpaceElement` using a
  numpy.dtype with shape
- Implement __array_ufunc__ interface for tensors and DiscreteLpElement
- Remove `order` from spaces, add to `element` instead
- Allow Numpy 1.13
- Rewrite documentation
- Rename `uspace` and `dspace` to `fspace` and `tspace`,
  respectively.
- Move fn_ops code to tensor_ops
- Implement `MatrixOperator` for multiple axes
- Allow `field=None` in LinearSpace
- Remove local Numpy compat code
- Adapt tests
- Simplify pytest fixtures
@kohr-h
Copy link
Member Author

kohr-h commented Nov 14, 2017

Closed by #1088

@kohr-h kohr-h closed this as completed Nov 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants