octave-maintainers
[Top][All Lists]
Advanced

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

Re: uint8NDArray


From: John W. Eaton
Subject: Re: uint8NDArray
Date: Fri, 26 Jul 2013 15:04:05 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12

On 07/26/2013 02:57 PM, Jordi GutiƩrrez Hermoso wrote:

You need to allocate space for uint8NDArray. It does not
bounds-checking by default, so you're just writing to uninitialised
memory. You have to pass a dim_vector to the uint8NDArray constructor
saying what size you want the array to be before you start writing to
it.

Good catch.

Also, iterating through the elements and using operator() to assign elements is going to be slow because the reference count for the NDArray object will be checked each time. Chances are you should be getting a pointer to the data and using some kind of read function that reads the file all at once (after the dimensions are discovered and used to allocate the array).

jwe


reply via email to

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