help-octave
[Top][All Lists]
Advanced

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

Re: About resize() function


From: Jaroslav Hajek
Subject: Re: About resize() function
Date: Fri, 24 Oct 2008 10:53:02 +0200

On Fri, Oct 24, 2008 at 10:24 AM, José Luis García Pallero
<address@hidden> wrote:
> Ok, but the fact that some elements are not preserved if the new matrix is
> samaller is logical. I think that the help of the function is quite
> confused.

I agree. Also, the behaviour when given a single dimension argument is
not logical - IMHO, it should do a vector resize (similarly to what
assigning to a non-existent vector element does). I intend to patch
resize soon, after I finish the patch I'm now working on, improving
the speed of dense indexing and cleaning up the indexing code in
Array<T>.

regards,


>
> 2008/10/24 Bill Denney <address@hidden>
>>
>> José Luis García Pallero wrote:
>> > But in fact, not is a destructive resize, or I didn't understand what
>> > *Values in X are not preserved as they are with `reshape'.* means.
>> > For example, if:
>> >
>> > a=[1 2;3 4];
>> > resize(a,3,3) returns:
>> >
>> > 1 2 0
>> > 3 4 0
>> > 0 0 0
>> >
>> > Is the function wrong or the help
>> Both are correct if you do things a little differently.  Values are not
>> preserved if you make the matrix smaller.  Try the following:
>>
>> a = [1 2;3 4];
>> resize(a, 1, 3)
>>
>> Have a good day,
>>
>> Bill
>
>
>
> --
> *****************************************
> José Luis García Pallero
> address@hidden
> (o<
> / / \
> V_/_
> Use Debian GNU/Linux and enjoy!
> *****************************************
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
>



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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