help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dimension slice


From: Jaroslav Hajek
Subject: Re: dimension slice
Date: Sun, 9 Jan 2011 21:22:14 +0100

2011/1/7 Jordi Gutiérrez Hermoso <address@hidden>:
> On 6 January 2011 21:40, Glen Shennan <address@hidden> wrote:
>> You mean matrix(1,:,:)   Yes, that worked, cheers.  But is there a way to do
>> it in the n-dimensional case?
>
> Flatten it into a normal matrix, perhaps obtained with a Kronecker
> (tensor) product and slice it like so?
>
>     a(k:k+1,j:j+1)
>
> in order to get the 2x2 block at the j,k position.
>
> I know what you think you want, but what you really want is this. ;-)
>
> Octave Nd-arrays should be used sparingly. Octave is highly optimised
> for ordinary matrices, not Nd-arrays. Okay, maybe Jaroslav optimised
> Nd-arrays much more while I wasn't looking, but Nd-arrays of high
> dimensionality are still in general somewhat awkward. Stick to normal
> matrices.
>

I disagree. Yes, there are some 2D-specific optimizations, but nothing
big I guess. Certainly no reason to *avoid* N-d arrays. Quite to the
contrary, I think that sometimes using an N-d array where otherwise
you'd use a matrix with some home-made index transformation can boost
the performance of both your code and your coding :)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]