Skip to content

ranocha/EllipsisNotation.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EllipsisNotation.jl

Build Status Build status

This implements the notation .. for indexing arrays. It's similar to the Python ... in that it means "all of the columns before (or after)".

Installation

Pkg.add("EllipsisNotation")
using EllipsisNotation

Example Usage

A = Array{Int}(2,4,2)

A[..,1] = [2 1 4 5
           2 2 3 6]

A[..,2] = [3 2 6 5
          3 2 6 6]

A[:,:,1] == [2 1 4 5
             2 2 3 6] #true

A[1,..] = reshape([3 4
                  5 6
                  4 5
                  6 7],1,4,2) #v0.4 doesn't drop singleton dimension, v0.5 does

B = [3 4
    5 6
    4 5
    6 7]

B == reshape(A[1,..],4,2) #true

A[..,1,2] # Can do as many integers as you want on the end!

Acknowledgements

I would like to acknowledge M. Schauer for the .. notation implementation. He had the original idea, I just extended it and put it into a package because of how useful it has been to me.

About

Implements the notation `..` for indexing arrays.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Julia 100.0%