[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
maybe C++ and not "C" ? (was Re: function space)
From: |
Sergei Steshenko |
Subject: |
maybe C++ and not "C" ? (was Re: function space) |
Date: |
Wed, 22 Feb 2012 13:58:41 -0800 (PST) |
--- On Tue, 2/21/12, CdeMills <address@hidden> wrote:
> From: CdeMills <address@hidden>
> Subject: Re: function space
> To: address@hidden
> Date: Tuesday, February 21, 2012, 2:26 PM
>
[snip]
>
> For instance, I prefer R which makes a clear difference
> between function
> calls and array indexing. The price to pay is that the
> concatenation
> operator is not available, as it was "taken" for array
> indexing, and is
> replaced by the function "c", abbreviation of cat.
>
> OTOH, I'm porting a Octave program to C in order to run it
> on an embedded
> platform. And I may assure you that the m-languages has some
> issues, but at
> least operators works on vector and matrices. A single line
> like
> x = y(some condition on y) % x and y are vectors
> is translated in many lines:
> - malloc an array of size (y), and test if the result is OK
> - loop on y, test the condition, fill the temporary array
> - count the number of non-null elements in the temporary
> array
> - free x memory
> - allocate x memory with the count you've computed (and test
> it)
> - loop on the temp vector, find the non-null elements, use
> their index to
> access y; concatenate the results in x
> - do not forget to free the temp array
>
> So yes there are a few flaws in the m-language, but you gain
> development
> speed, compactness, no need to declare variables, memory is
> managed for you,
> ...
>
> Regards
> Pascal
>
> --
> View this message in context:
> http://octave.1599824.n4.nabble.com/function-space-tp4408021p4408551.html
> Sent from the Octave - General mailing list archive at
> Nabble.com.
>
Though I'm not a fan of C++, I must admit it does have some advantages over "C".
For what you are doing maybe the following:
http://arma.sourceforge.net/
http://eigen.tuxfamily.org/index.php?title=Main_Page
are useful. There are more similar projects, I remember just those two off the
top of my head.
...
Does 'boost' library have matrix classes ?
Regards,
Sergei.