Path: news.mathworks.com!newsfeed-00.mathworks.com!NNTP.WPI.EDU!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: Modifying MEX arguments in place?
Date: Thu, 14 Feb 2008 04:38:38 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 21
Message-ID: <fp0gke$gqq$1@canopus.cc.umanitoba.ca>
References: <fp0fqv$3gd$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1202963918 17242 192.70.172.160 (14 Feb 2008 04:38:38 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Thu, 14 Feb 2008 04:38:38 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:451298



In article <fp0fqv$3gd$1@fred.mathworks.com>,
Petr Krysl <pkryslNOSP@Mucsd.edu> wrote:
>For the MEX experts out there: I would like to factor a huge
>matrix (passed in as a one-dimensional array) in-place in a
>mex file.  Unfortunately, the documentation says there may
>be side effects (and there are: the Matlab executive is
>apparently getting all mixed up).

>Is there no way I could modify an argument in-place?

I know little about MEX, but generally speaking, the memory
that you are handed for any Matlab variable might be shared
with other Matlab variables due to the "lazy copy" behaviour.
The columns you see might be linked to columns of other variables.
When you change the memory in-place, you would have changed those
other variables too.
-- 
  "Let me live in my house by the side of the road --
   It's here the race of men go by.
   They are good, they are bad, they are weak, they are strong
   Wise, foolish -- so am I;"                 -- Sam Walter Foss