Skip to content

Commit

Permalink
Add squeeze requirements from #9271 to docs
Browse files Browse the repository at this point in the history
Also clean up spacing for `permutedims` while I'm here.

cc @ivarne
  • Loading branch information
simonster committed Dec 9, 2014
1 parent 3947393 commit 2f09b93
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions doc/stdlib/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4469,21 +4469,22 @@ Indexing, Assignment, and Concatenation
Find the next index >= ``i`` of an element of ``A`` equal to ``v`` (using ``==``),
or ``0`` if not found.

.. function:: permutedims(A,perm)
.. function:: permutedims(A, perm)

Permute the dimensions of array ``A``. ``perm`` is a vector specifying a permutation of length ``ndims(A)``. This is a generalization of transpose for multi-dimensional arrays. Transpose is equivalent to ``permutedims(A,[2,1])``.
Permute the dimensions of array ``A``. ``perm`` is a vector specifying a permutation of length ``ndims(A)``. This is a generalization of transpose for multi-dimensional arrays. Transpose is equivalent to ``permutedims(A, [2,1])``.

.. function:: ipermutedims(A,perm)
.. function:: ipermutedims(A, perm)

Like :func:`permutedims`, except the inverse of the given permutation is applied.

.. function:: permutedims!(dest,src,perm)
.. function:: permutedims!(dest, src, perm)

Permute the dimensions of array ``src`` and store the result in the array ``dest``. ``perm`` is a vector specifying a permutation of length ``ndims(src)``. The preallocated array ``dest`` should have ``size(dest)=size(src)[perm]`` and is completely overwritten. No in-place permutation is supported and unexpected results will happen if `src` and `dest` have overlapping memory regions.
Permute the dimensions of array ``src`` and store the result in the array ``dest``. ``perm`` is a vector specifying a permutation of length ``ndims(src)``. The preallocated array ``dest`` should have ``size(dest) == size(src)[perm]`` and is completely overwritten. No in-place permutation is supported and unexpected results will happen if `src` and `dest` have overlapping memory regions.

.. function:: squeeze(A, dims)

Remove the dimensions specified by ``dims`` from array ``A``
Remove the dimensions specified by ``dims`` from array ``A``. Elements of
``dims`` must be unique and be within the interval ``[1, ndims(A)]``.

This comment has been minimized.

Copy link
@ivarne

ivarne Dec 9, 2014

Member

Thanks!

It's obvious from the context that you intend a closed interval 1,ndims(A), but is it clearer to use a Julia range instead?

... must be unique and in the range ``1:ndims(A)``

I always forget which brace you use for open and closed intervals.

This comment has been minimized.

Copy link
@simonster

simonster Dec 9, 2014

Author Member

Good point.

This comment has been minimized.

Copy link
@ivarne

ivarne Dec 9, 2014

Member

We should also mention that the squeezed dimensions must have size(A, dim) == 1. Not sure how to phrase that properly. Is that what we call a "singleton dimension"?

This comment has been minimized.

Copy link
@StefanKarpinski

StefanKarpinski Dec 9, 2014

Member

Why not just say what you just said?


.. function:: vec(Array) -> Vector

Expand Down

0 comments on commit 2f09b93

Please sign in to comment.