opencv/3rdparty/clapack/runtime/pow_di.c
Vadim Pisarevsky 2ee9d21dae
Merge pull request #18571 from vpisarev:add_lapack
Added clapack

* bring a small subset of Lapack, automatically converted to C, into OpenCV

* added missing lsame_ prototype

* * small fix in make_clapack script
* trying to fix remaining CI problems

* fixed character arrays' initializers

* get rid of F2C_STR_MAX

* * added back single-precision versions for QR, LU and Cholesky decompositions. It adds very little extra overhead.
* added stub version of sdesdd.
* uncommented calls to all the single-precision Lapack functions from opencv/core/src/hal_internal.cpp.

* fixed warning from Visual Studio + cleaned f2c runtime a bit

* * regenerated Lapack w/o forward declarations of intrinsic functions (such as sqrt(), r_cnjg() etc.)
* at once, trailing whitespaces are removed from the generated sources, just in case
* since there is no declarations of intrinsic functions anymore, we could turn some of them into inline functions

* trying to eliminate the crash on ARM

* fixed API and semantics of s_copy

* * CLapack has been tested successfully. It's now time to restore the standard LAPACK detection procedure
* removed some more trailing whitespaces

* * retained only the essential stuff in CLapack
* added checks to lapack calls to gracefully return "not implemented" instead of returning invalid results with "ok" status

* disabled warning when building lapack

* cmake: update LAPACK detection

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
2020-11-05 21:46:51 +00:00

28 lines
430 B
C

#include "f2c.h"
double pow_di(double *ap, int *bp)
{
double p = 1;
double x = *ap;
int n = *bp;
if(n != 0)
{
if(n < 0)
{
n = -n;
x = 1/x;
}
unsigned u = (unsigned)n;
for(;;)
{
if((u & 1) != 0)
p *= x;
if((u >>= 1) == 0)
break;
x *= x;
}
}
return p;
}