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

Improve differences from R documentation #26810

Merged
merged 1 commit into from
Apr 17, 2018

Conversation

bkamins
Copy link
Member

@bkamins bkamins commented Apr 14, 2018

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).

`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
Copy link
Member

Choose a reason for hiding this comment

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

Missing dims=?

Copy link
Contributor

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..."

Copy link
Member Author

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
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@ararslan
Copy link
Member

LGTM aside from what I noted.

@ararslan ararslan added the docs This change adds or pertains to documentation label Apr 14, 2018
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
Copy link
Member

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?

Copy link
Member Author

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.
Copy link
Contributor

@waldyrious waldyrious Apr 14, 2018

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

Copy link
Member Author

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).
@bkamins
Copy link
Member Author

bkamins commented Apr 14, 2018

All fixed. Thank you for the review.

@JeffBezanson JeffBezanson merged commit ca7e837 into JuliaLang:master Apr 17, 2018
@bkamins bkamins deleted the patch-24 branch April 17, 2018 19:39
mbauman added a commit that referenced this pull request Apr 19, 2018
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants