|
From: | David Bateman |
Subject: | Re: More efficient MEX or MEX-like interface |
Date: | Tue, 14 Oct 2008 20:24:39 +0100 |
User-agent: | Mozilla-Thunderbird 2.0.0.16 (X11/20080724) |
John W. Eaton wrote:
| It would be good is we could also have a use methods like| | const mxArray *| octave_matrix::as_mxArray (void) const | { | mxArray *retval = new mxArray (mxDOUBLE_CLASS, dims (), mxREAL); | retval.set_data (matrix.fortran_vec ()); | return retval; | }| | and we'd need an appropriate const version of set_data added to the mex | interface. Is this possible or am I missing something?Yes, you could get the data this way without having to copy if you promise not to change the data through the pointer that is returned (that's what the const qualifier here will do, yes?). So that can help to improve efficiency for an extended MEX interface, but not for the original MEX interface (as I recall, anyway).
As far as I can see we then also need a const mxArray *mex::make_value (const octave_value& ov) { return new mxArray (ov); }method and then need to modify mex.cc (call_mex) such that the "argin" variable is const if "V4" is not defined. So I don't really see why at least this little modification isn't possible as it would give a significant speed up.
D. -- David Bateman address@hidden 35 rue Gambetta +33 1 46 04 02 18 (Home) 92100 Boulogne-Billancourt FRANCE +33 6 72 01 06 33 (Mob)
[Prev in Thread] | Current Thread | [Next in Thread] |