-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Improve differences from R documentation #26810
Conversation
`sum(B,1)=11` and `sum(B,2)=12`. If the second argument is a vector, then it specifies all the | ||
dimensions over which the sum is performed, e.g., `sum(A,[1,2])=10`. It should be noted that | ||
there is no error checking regarding the second argument. | ||
`sum(B,1) == 11` and `sum(B,2) == 12`. If `dims` keyword argument is a vector, then it specifies all |
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.
Missing dims=
?
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.
Also missing a "the": "If the `dims` keyword argument..."
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.
Both fixed. In R I decided to replace the examples colSums
and rowSums
functions as they are designed to make such sums so it is a better reference.
dimensions, over which the operation is carried out. For instance, let `A=[[1 2],[3 4]]` in Julia | ||
and `B=rbind(c(1,2),c(3,4))` be the same matrix in R. Then `sum(A)` gives the same result as | ||
`sum(B)`, but `sum(A, 1)` is a row vector containing the sum over each column and `sum(A, 2)` | ||
dimensions, over which the operation is carried out. For instance, let `A=[1 2; 3 4]` in Julia |
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.
Could add a space around the Julia =
as you've done with the R <-
assignment.
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.
fixed
LGTM aside from what I noted. |
there is no error checking regarding the second argument. | ||
`sum(B,1) == 11` and `sum(B,2) == 12`. If `dims` keyword argument is a vector, then it specifies all | ||
the dimensions over which the sum is performed, while retaining the dimensions of the summed array, e.g., | ||
`sum(A, dims=[1,2]) == hcat(10)`. It should be noted that there is no error checking regarding the |
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.
Might be slightly better to use a tuple for the dimensions?
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.
fixed
the `'` operator. Julia's `A.'` is therefore equivalent to R's `t(A)`. | ||
* Julia performs matrix transposition using the `transpose` function and conjugated transposition using | ||
the `'` operator or `adjoint` function. Julia's `transpose(A)` is therefore equivalent to R's `t(A)`. | ||
Additionally a non-recursive transpose in Julia is provided by `permutedims` function. |
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.
or the `adjoint` function
by the `permutedims` function
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.
fixed
Changes: * change of `.'` to `transpose` and `permutedims`; * explain that named tuple gives functionality similar to `list` in R; * fix example of creating a matrix using `A=[[1 2],[3 4]]` (which is wrong) and then using `sum(A, 1)` syntax (which is deprecated).
All fixed. Thank you for the review. |
* origin/master: (22 commits) separate `isbitstype(::Type)` from `isbits` (#26850) bugfix for regex matches ending with non-ASCII (#26831) [NewOptimizer] track inbounds state as a per-statement flag change default LOAD_PATH and DEPOT_PATH (#26804, fix #25709) Change url scheme to https (#26835) [NewOptimizer] inlining: Refactor todo object inference: enable CodeInfo method_for_inference_limit_heuristics support (#26822) [NewOptimizer] Fix _apply elision (#26821) add test case from issue #26607, cfunction with no args (#26838) add `do` in front-end deparser. fixes #17781 (#26840) Preserve CallInst metadata in LateLowerGCFrame pass. Improve differences from R documentation (#26810) reserve syntax that could be used for computed field types (#18466) (#26816) Add support for Atomic{Bool} (Fix #26542). (#26597) Remove argument restriction on dims2string and inds2string (#26799) (#26817) remove some unnecessary `eltype` methods (#26791) optimize: ensure merge_value_ssa doesn't drop PiNodes inference: improve tmerge for Conditional and Const ensure more iterators stay type-stable code loading docs (#26787) ...
Changes:
.'
totranspose
andpermutedims
;list
in R;A=[[1 2],[3 4]]
(which is wrong) and then usingsum(A, 1)
syntax (which is deprecated).