help-octave
[Top][All Lists]
Advanced

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

Re: Fast copy of buffer data into a matrix


From: John W. Eaton
Subject: Re: Fast copy of buffer data into a matrix
Date: Fri, 9 Feb 2007 12:55:30 -0500

On  9-Feb-2007, John Swensen wrote:

| Is there a difference between:
| 1) static unit8NDArray m (dim_vector(settings.width, settings.height));
| and
| 2) static uint8NDArray m = octave_value(m1).uint8_array_value();
| ?

Yes.  Is m1 a Matrix object?  Assuming it is, then the first statement
creates a uint8NDArray object directly and the second takes m1 (double
values if it is a Matrix object), wraps it in an octave_value object,
then extracts a uint8NDArray object from it, requiring a type
conversion and data copying.  So the second is a lot more work and
wastes space if all you really want is a uint8NDArray object.

jwe


reply via email to

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