Re: outer product implementation
David Bateman <[email protected]> Sun, 10 Sep 2006 21:24:33 +0200
| Newsgroups | gmane.comp.gnu.octave.sources |
|---|---|
| Organization | Motorola CRM |
| Message-ID | <[email protected]> |
Muthiah Annamalai wrote:
> Paul,
> I have fixed the 2nd version of the outer product code as you had asked
> me
> to using C++ style inline functions etc & TexInfo documentation.
>
> The older code can be found at.
> http://www.cae.wisc.edu/pipermail/octave-sources/2006-April/000000.html
>
> Im attaching the new code & the same test case.
> Thanks
> Muthu
Muthu,
For the string name functions, you might want to look at the code in
quad.cc that creates a temporary function based on the string argument
that is passed. Extract the relevant parts, you'll need code something like
std::string fcn_name;
octave_function *fcn;
if (args(0).is_function_handle () || args(0).is_inline_function ())
fcn = args(0).function_value ();
else if (args(0).is_string())
{
fcn_name = unique_symbol_name ("__fcn_");
std::string fname = "function z = ";
fname.append (fcn_name);
fname.append ("(x, y) z = ");
fcn = extract_function (args(0), "outer", fcn_name, fname,
"(x, y); endfunction");
}
if (error_state || !fcn)
{
error("sensible error message");
return retval;
}
// Do want ever you want to do with fcn
....
if (fcn_name.length())
// We have a string function name. Dealloc temp func
clear_function (fcn_name);
added to your code.
D.