> 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.
> 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 . That is the function called from the interpreter when you
type "sqrt(2)" for example. In  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"
, the latter one is "std::sqrt" with handling of special complex number
> 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.
octave > help sqrt
'sqrt' is a built-in function from the file libinterp/corefcn/mappers.cc
-- sqrt (X)
Compute the square root of each element of X.
If X is negative, a complex result is returned.
To compute the matrix square root, see *note Linear Algebra::.