Re: [julia-users] Row/column iterators?

2016-06-27 Thread Tom Breloff
Thanks Tim!  I can always count on you to have solutions for everything :)

On Mon, Jun 27, 2016 at 11:31 AM, Tim Holy  wrote:

> In Base there's mapslices, which may already do what you want.
>
> Something like what you're proposing (but not yet with a nice "high level"
> API
> wrapper, since the low-level stuff is still in flux) is already here:
> https://github.com/timholy/ArrayIteration.jl
> That's aiming at a very general approach that should be efficient for a
> wide
> variety of AbstractArrays (dense, sparse, perhaps even distributed, etc). I
> bet you don't need so much generality?
>
> Assuming you'd be happy with something that works well for just dense
> matrices, your `view(mat, :, i)` idea should work just fine. Given that
> julia-0.5 is just around the corner, my assumption is that it would be
> best to
> put it in a package first, and think about adding to Base later. (But I'm
> not
> opposed to sticking it in now, either.)
>
> Best,
> --Tim
>
> On Monday, June 27, 2016 9:42:33 AM CDT Tom Breloff wrote:
> > I find myself frequently wanting to do something like:
> >
> > mat = rand(100,4)
> > for c in columns(mat)
> > # c is a vector (a view maybe?)
> > end
> >
> > I think ideally this method would return a lazy iterator which returns a
> > `view(mat, :, i)` at each step.  Does this exist already?  If not, would
> it
> > be welcomed in Base?
> >
> > -Tom
>
>
>


Re: [julia-users] Row/column iterators?

2016-06-27 Thread Tim Holy
In Base there's mapslices, which may already do what you want.

Something like what you're proposing (but not yet with a nice "high level" API 
wrapper, since the low-level stuff is still in flux) is already here:
https://github.com/timholy/ArrayIteration.jl
That's aiming at a very general approach that should be efficient for a wide 
variety of AbstractArrays (dense, sparse, perhaps even distributed, etc). I 
bet you don't need so much generality?

Assuming you'd be happy with something that works well for just dense 
matrices, your `view(mat, :, i)` idea should work just fine. Given that 
julia-0.5 is just around the corner, my assumption is that it would be best to 
put it in a package first, and think about adding to Base later. (But I'm not 
opposed to sticking it in now, either.)

Best,
--Tim

On Monday, June 27, 2016 9:42:33 AM CDT Tom Breloff wrote:
> I find myself frequently wanting to do something like:
> 
> mat = rand(100,4)
> for c in columns(mat)
> # c is a vector (a view maybe?)
> end
> 
> I think ideally this method would return a lazy iterator which returns a
> `view(mat, :, i)` at each step.  Does this exist already?  If not, would it
> be welcomed in Base?
> 
> -Tom




Re: [julia-users] Row/column iterators?

2016-06-27 Thread Tom Breloff
Thanks for the link!  I'll continue the discussion there.

On Mon, Jun 27, 2016 at 10:06 AM, Kristoffer Carlsson  wrote:

> https://github.com/JuliaLang/julia/issues/14491


[julia-users] Row/column iterators?

2016-06-27 Thread Kristoffer Carlsson
https://github.com/JuliaLang/julia/issues/14491