help-octave
[Top][All Lists]
Advanced

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

Re: Information Octave


From: siko1056
Subject: Re: Information Octave
Date: Mon, 6 Nov 2017 08:39:21 -0700 (MST)

Pietro Maggio wrote
> Good morning,
> 
> I'm a student who is using Octave and I need some information.
> 
> I would need to parse the default Sqrt() function to understand which
> algorithm is implemented; where can I find the implementation?
> 
> Thanks so much.
> 
> 
> Greetings.
> 
> Pietro Maggio

Hello Pietro Maggio,

I do not fully understand what you mean by "parse the default Sqrt()"
especially "parsing"?  But I'll try to answer:  The sqrt-function itself is
defined in [1].  That is the function called from the interpreter when you
type "sqrt(2)" for example.  In [1] you see, that the work just gets
forwarded to the underlying datatype of the first argument `args(0)`, in my
example "2" (real double scalar).  So the actual "sqrt algorithm" invoked
depends on your datatype (a real/complex double/float/int matrix/scalar,
...).  To my knowledge from searching within the sources, most likely it
will be forwarded to an element-wise "std::sqrt" or "octave::math::rc_sqrt"
[2], the latter one is "std::sqrt" with handling of special complex number
cases.

HTH,
Kai

[1]:
http://hg.savannah.gnu.org/hgweb/octave/file/558de6a42ff7/libinterp/corefcn/mappers.cc#l1969
[2]:
http://hg.savannah.gnu.org/hgweb/octave/file/558de6a42ff7/liboctave/numeric/lo-mappers.cc#l321




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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