Skip to content

Add more array expressions.#906

Merged
mrocklin merged 16 commits into
blaze:masterfrom
mrocklin:array-expr
Dec 30, 2014
Merged

Add more array expressions.#906
mrocklin merged 16 commits into
blaze:masterfrom
mrocklin:array-expr

Conversation

@mrocklin

Copy link
Copy Markdown
Member

Add TensorDot and Transpose expressions. Also fix shape handling and enforce dshape validation on binary operators.

In [1]: from blaze import *

In [2]: x = symbol('x', '10 * 20 * int')

In [3]: y = symbol('y', '20 * 30 * int')
In [4]: x + y
ValueError: Shapes don't align, (10, 20)

In [5]: x.dot(y)
tensordot(x, y)

In [6]: y.T
transpose(y)

@mrocklin

Copy link
Copy Markdown
Member Author

@cpcloud this could use your review.

@cpcloud

cpcloud commented Dec 30, 2014

Copy link
Copy Markdown
Member

reviewing now

Comment thread blaze/expr/arithmetic.py Outdated

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.

what's the reason for this? maybe do assert result.dshape instead just indicate that this needs to be run

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For various reasons I don't like putting logic into the type constructors. Most of the logic is checked however when running dshape. Calling assert would work if the comment isn't sufficient to demonstrate intent.

@cpcloud

cpcloud commented Dec 30, 2014

Copy link
Copy Markdown
Member

people are going to start asking for a solve interface now :)

1.  transpose(..., axes=None) defaults to tuple(range(n))[::-1]
2.  whitespace
3.  Test on shape asserts ValueError, not Exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants