Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pypy pypy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 675
    • Issues 675
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyPyPyPy
  • pypypypy
  • Merge requests
  • !431

Enhanced implementation for numpy.broadcast

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Bitbucket Importer requested to merge bitbucket/declined-pr-431 into branch/default Apr 24, 2016
  • Overview 2
  • Commits 0
  • Pipelines 0
  • Changes 0

Created originally on Bitbucket by Serge Matyunin (Sergey Matyunin)

Changesets for this Pull Request have not been imported, because it had been already declined on Bitbucket. Marked as closed by the import user.

  • In W_Broadcast (micronumpy) implemented nd and iters attributes, reset method.
  • W_Broadcast is rewritten using W_FlatIterator for implementation of iters attribute.
  • W_FlatIterator gets optional arguments in constructor, added reset method

Now implementation of broadcast seems complete.

Known problem: broadcast of broadcast doesn't work properly. The following code from test_numeric.py in numpy fails on the second loop iteration:

    def test_broadcast_in_args(self):
        # gh-5881
        arrs = [np.empty((6, 7)), np.empty((5, 6, 1)), np.empty((7,)),
                np.empty((5, 1, 7))]
        mits = [np.broadcast(*arrs),
                np.broadcast(np.broadcast(*arrs[:2]), np.broadcast(*arrs[2:])),
                np.broadcast(arrs[0], np.broadcast(*arrs[1:-1]), arrs[-1])]
        for mit in mits:
            assert_equal(mit.shape, (5, 6, 7))
            assert_equal(mit.nd, 3)
            assert_equal(mit.numiter, 4)
            for a, ia in zip(arrs, mit.iters):
                assert_(a is ia.base)

It means np.broadcast(np.broadcast(*arrs[:2]), np.broadcast(*arrs[2:])) doesn't work.

I will try to fix it in another PR.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: bitbucket/declined-pr-431