-
Notifications
You must be signed in to change notification settings - Fork 14
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
Create #1
Conversation
probably want to implement a bunch of the optional |
Julia 1.1 is noticable better at constant propergation such that things happen at compile time. |
Codecov Report
@@ Coverage Diff @@
## master #1 +/- ##
===========================================
+ Coverage 0% 91.66% +91.66%
===========================================
Files 1 5 +4
Lines 1 72 +71
===========================================
+ Hits 0 66 +66
- Misses 1 6 +5
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like you would want to return a NamedDimsArray
from operations on a NamedDimsArray
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems mostly fine, but the inconsistent conventions bugs me a little. There appears to be a mixture of _
s, combined and shortened names. It'd be good to pick one convention for the package.
src/NamedDims.jl
Outdated
|
||
greet() = print("Hello World!") | ||
export NamedDimsArray, name2dim, dim_names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems weird to only partially follow the _
convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i prefer a2b
naming only for Dict
s but I don't have a good alternative
Although if name2dim
is part of the public API i'd like to try finding a better name :)
Is dim[s]
or dimension[s]
better or worse?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so name_to_dim
?
I am ok with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_dim
?
dim
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i quite to like dims(names)
and dims(names, name)
...but maybe it's scarily short?
plus NamedDims.dims
goes nicely with NamedDims.names
edit: think dims
better than dim
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have axes
it is only slightly shorter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't do dims
,
it is a kwarg on functions that want to call this.
e.g.
sum(xs::NamedDimArray; dims)=sum(parent(xs), dims(xs, dims))
does not work; and
sum(xs::NamedDimArray; dims)=sum(parent(xs), NamedDimArray.dims(xs, dims))
is ugly.
Co-Authored-By: oxinabox <oxinabox@ucc.asn.au>
Co-Authored-By: oxinabox <oxinabox@ucc.asn.au>
Co-Authored-By: oxinabox <oxinabox@ucc.asn.au>
Added dropdims, because I implemented the code for it by mistake (I thought summing over a dimension dropped that dimension, but apparently not (did it used to?)) This is ready for another round of review. |
LGTM (bar very minor style things) I'd quite like to test on both the 1d and Nd case, but extra tests can always be added later :) Good work! |
Co-Authored-By: oxinabox <oxinabox@ucc.asn.au>
Co-Authored-By: oxinabox <oxinabox@ucc.asn.au>
Checklist from JuliaCollections/AxisArraysFuture#1 (comment)
AbstractArray
giving names to the indexes. The index named can go in the type paramsname2dim(::NamedDimsArray, ::Symbol)::Int
that will take an array with named dimentsions and dimention name, and return its dimension index.dims
argument. Likesum
andmean
- that return
NamedDimArrays
AbstractArray
methods see docs