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

[query] teach hl.array to convert 1-d ndarrays #12810

Merged
merged 5 commits into from
Mar 23, 2023

Conversation

danking
Copy link
Contributor

@danking danking commented Mar 22, 2023

CHANGELOG: hl.array can now convert 1-d ndarrays into the equivalent list.

We leave the improvement of the implementation of _data_array to a future PR.

CHANGELOG: hl.array can now convert 1-d ndarrays into the equivalent list.

We leave the improvement of the implementation of `_data_array` to a future PR.

There was one usage of `_data_array` that I could not convince myself used a 1-d ndarray. Thoughts?

```
    # ...
    def numpy_to_cols_table(X, field_name):
        hail_array = X._data_array()
        cols_and_X = hl.zip(A.source_table.index_globals().cols, hail_array).map(lambda tup: tup[0].annotate(**{field_name: tup[1]}))
        t = hl.Table.parallelize(cols_and_X, key=A.col_key)
        return t

    st = None
    lt = None
    eigens = hl.eval(S * S)
    if transpose:
        if compute_loadings:
            lt = numpy_to_cols_table(V, 'loadings')
    # ...
```
[1, 2, 3],
[1, 7],
[1, 2, 3, 3]
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you're missing an assertion?

@danking danking dismissed patrick-schultz’s stale review March 22, 2023 13:32

whoops yep; fixed. Thanks!

@danking danking merged commit 22856d6 into hail-is:main Mar 23, 2023
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.

2 participants