mirror of
https://github.com/opencv/opencv.git
synced 2024-12-13 07:59:27 +08:00
2ee9d21dae
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>
130 lines
2.5 KiB
C
130 lines
2.5 KiB
C
/* f2c.h -- Standard Fortran to C header file */
|
|
|
|
/** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
|
|
|
|
- From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
|
|
|
|
#ifndef __F2C_H__
|
|
#define __F2C_H__
|
|
|
|
#include <assert.h>
|
|
#include <math.h>
|
|
#include <ctype.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#include "cblas.h"
|
|
#include "lapack.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#undef complex
|
|
|
|
typedef int integer;
|
|
typedef unsigned int uinteger;
|
|
typedef char *address;
|
|
typedef short int shortint;
|
|
typedef float real;
|
|
typedef double doublereal;
|
|
typedef lapack_complex complex;
|
|
typedef lapack_doublecomplex doublecomplex;
|
|
typedef int logical;
|
|
typedef short int shortlogical;
|
|
typedef char logical1;
|
|
typedef char integer1;
|
|
|
|
#define TRUE_ (1)
|
|
#define FALSE_ (0)
|
|
|
|
#ifndef abs
|
|
#define abs(x) ((x) >= 0 ? (x) : -(x))
|
|
#endif
|
|
#define dabs(x) (double)abs(x)
|
|
#ifndef min
|
|
#define min(a,b) ((a) <= (b) ? (a) : (b))
|
|
#endif
|
|
#ifndef max
|
|
#define max(a,b) ((a) >= (b) ? (a) : (b))
|
|
#endif
|
|
#define dmin(a,b) (double)min(a,b)
|
|
#define dmax(a,b) (double)max(a,b)
|
|
#define bit_test(a,b) ((a) >> (b) & 1)
|
|
#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
|
|
#define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
|
|
|
|
static __inline double r_lg10(float *x)
|
|
{
|
|
return 0.43429448190325182765*log(*x);
|
|
}
|
|
|
|
static __inline double d_lg10(double *x)
|
|
{
|
|
return 0.43429448190325182765*log(*x);
|
|
}
|
|
|
|
static __inline double d_sign(double *a, double *b)
|
|
{
|
|
double x = fabs(*a);
|
|
return *b >= 0 ? x : -x;
|
|
}
|
|
|
|
static __inline double r_sign(float *a, float *b)
|
|
{
|
|
double x = fabs((double)*a);
|
|
return *b >= 0 ? x : -x;
|
|
}
|
|
|
|
static __inline int i_nint(float *x)
|
|
{
|
|
return (int)(*x >= 0 ? floor(*x + .5) : -floor(.5 - *x));
|
|
}
|
|
|
|
int pow_ii(int *ap, int *bp);
|
|
double pow_di(double *ap, int *bp);
|
|
static __inline double pow_ri(float *ap, int *bp)
|
|
{
|
|
double apd = *ap;
|
|
return pow_di(&apd, bp);
|
|
}
|
|
static __inline double pow_dd(double *ap, double *bp)
|
|
{
|
|
return pow(*ap, *bp);
|
|
}
|
|
|
|
static __inline void d_cnjg(doublecomplex *r, doublecomplex *z)
|
|
{
|
|
double zi = z->i;
|
|
r->r = z->r;
|
|
r->i = -zi;
|
|
}
|
|
|
|
static __inline void r_cnjg(complex *r, complex *z)
|
|
{
|
|
float zi = z->i;
|
|
r->r = z->r;
|
|
r->i = -zi;
|
|
}
|
|
|
|
static __inline int s_copy(char *a, char *b, int maxlen)
|
|
{
|
|
strncpy(a, b, maxlen);
|
|
a[maxlen] = '\0';
|
|
return 0;
|
|
}
|
|
|
|
int s_cat(char *lp, char **rpp, int* rnp, int *np);
|
|
int s_cmp(char *a0, char *b0);
|
|
static __inline int i_len(char* s)
|
|
{
|
|
return (int)strlen(s);
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|