[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is the expected behaviour of resize of NDArrays?
From: |
David Bateman |
Subject: |
Re: What is the expected behaviour of resize of NDArrays? |
Date: |
Wed, 21 Apr 2004 01:14:03 +0200 |
User-agent: |
Mutt/1.4.1i |
Ok then I'd suggest the attached patch instead. It seems to me that
there were quite a few problems with resize_no_fill and
resize_and_fill, that appeared after my previous patch. The attached
patch addresses these also. I also attach a test oct-file that can be
called like
a = rand(2,2), b = dummy(a,ones(4,2),1)
or
a = rand(2,2), b = dummy(a,ones([4,2]))
to show the behaviour of the resize functions.
Regards
D.
According to John W. Eaton <address@hidden> (on 04/20/04):
> On 20-Apr-2004, David Bateman <address@hidden> wrote:
>
> | I have a problem that causes fft([1,2]',1) to crash for which a patch
> | is attached. However, while checking into this problem I identified a
> | strange difference in behaviour of resize_no_fill and resize_and_fill
> | in Array.cc. The code
> |
> | dim_vector dv;
> | NDArray a;
> | ...
> | a.resize (dv);
> |
> | Causes the random data to be placed at the end of a considered as a
> | single index if dv is larger than a.dims() is some dimension. Whilst,
> | if dv is smaller than a.dims() is some dimension then it cut from the
> | end. This means that a = [1, 3; 2, 4]; when resized to [1,2] becomes
> | [1, 2] !!!
> |
> | This is different than the behaviour for a.resize(dv, fill_value), which
> | respects the dimensioning of the previous array.
>
> I think they should both do the same thing except that the _no_fill
> version should leave any new elements outside the bounds of the
> original array undefined. So it looks like there is a bug in the
> current version of resize_no_fill.
>
> jwe
--
David Bateman address@hidden
Motorola CRM +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax)
91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
dummy.cc
Description: Text document
patch.resize2
Description: Text document