diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/blas.h | 160 | ||||
-rw-r--r-- | includes/constant.h | 20 | ||||
-rw-r--r-- | includes/lapack.h | 168 | ||||
-rw-r--r-- | includes/machine.h.in | 77 | ||||
-rw-r--r-- | includes/notFound.h | 18 |
5 files changed, 443 insertions, 0 deletions
diff --git a/includes/blas.h b/includes/blas.h new file mode 100644 index 00000000..86ab62f6 --- /dev/null +++ b/includes/blas.h @@ -0,0 +1,160 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __BLAS_H__ +#define __BLAS_H__ + + +#ifndef _MACRO_C2F_ +#define _MACRO_C2F_ +#define C2F(name) name##_ +#endif +/* + SUBROUTINE DGEMM ( TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, + $ BETA, C, LDC ) +* .. Scalar Arguments .. + CHARACTER*1 TRANSA, TRANSB + INTEGER M, N, K, LDA, LDB, LDC + DOUBLE PRECISION ALPHA, BETA +* .. Array Arguments .. + DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ) +* .. +C WARNING : this routine has been modified for Scilab (see comments +C Cscilab) because algorithm is not ok if A matrix contains NaN +C (NaN*0 should be NaN, not 0) +* Purpose +* ======= +* +* DGEMM performs one of the matrix-matrix operations +* +* C := alpha*op( A )*op( B ) + beta*C, +* +* where op( X ) is one of +* +* op( X ) = X or op( X ) = X', +* +* alpha and beta are scalars, and A, B and C are matrices, with op( A ) +* an m by k matrix, op( B ) a k by n matrix and C an m by n matrix. +* +* Parameters +* ========== +* +* TRANSA - CHARACTER*1. +* On entry, TRANSA specifies the form of op( A ) to be used in +* the matrix multiplication as follows: +* +* TRANSA = 'N' or 'n', op( A ) = A. +* +* TRANSA = 'T' or 't', op( A ) = A'. +* +* TRANSA = 'C' or 'c', op( A ) = A'. +* +* Unchanged on exit. +* +* TRANSB - CHARACTER*1. +* On entry, TRANSB specifies the form of op( B ) to be used in +* the matrix multiplication as follows: +* +* TRANSB = 'N' or 'n', op( B ) = B. +* +* TRANSB = 'T' or 't', op( B ) = B'. +* +* TRANSB = 'C' or 'c', op( B ) = B'. +* +* Unchanged on exit. +* +* M - INTEGER. +* On entry, M specifies the number of rows of the matrix +* op( A ) and of the matrix C. M must be at least zero. +* Unchanged on exit. +* +* N - INTEGER. +* On entry, N specifies the number of columns of the matrix +* op( B ) and the number of columns of the matrix C. N must be +* at least zero. +* Unchanged on exit. +* +* K - INTEGER. +* On entry, K specifies the number of columns of the matrix +* op( A ) and the number of rows of the matrix op( B ). K must +* be at least zero. +* Unchanged on exit. +* +* ALPHA - DOUBLE PRECISION. +* On entry, ALPHA specifies the scalar alpha. +* Unchanged on exit. +* +* A - DOUBLE PRECISION array of DIMENSION ( LDA, ka ), where ka is +* k when TRANSA = 'N' or 'n', and is m otherwise. +* Before entry with TRANSA = 'N' or 'n', the leading m by k +* part of the array A must contain the matrix A, otherwise +* the leading k by m part of the array A must contain the +* matrix A. +* Unchanged on exit. +* +* LDA - INTEGER. +* On entry, LDA specifies the first dimension of A as declared +* in the calling (sub) program. When TRANSA = 'N' or 'n' then +* LDA must be at least max( 1, m ), otherwise LDA must be at +* least max( 1, k ). +* Unchanged on exit. +* +* B - DOUBLE PRECISION array of DIMENSION ( LDB, kb ), where kb is +* n when TRANSB = 'N' or 'n', and is k otherwise. +* Before entry with TRANSB = 'N' or 'n', the leading k by n +* part of the array B must contain the matrix B, otherwise +* the leading n by k part of the array B must contain the +* matrix B. +* Unchanged on exit. +* +* LDB - INTEGER. +* On entry, LDB specifies the first dimension of B as declared +* in the calling (sub) program. When TRANSB = 'N' or 'n' then +* LDB must be at least max( 1, k ), otherwise LDB must be at +* least max( 1, n ). +* Unchanged on exit. +* +* BETA - DOUBLE PRECISION. +* On entry, BETA specifies the scalar beta. When BETA is +* supplied as zero then C need not be set on input. +* Unchanged on exit. +* +* C - DOUBLE PRECISION array of DIMENSION ( LDC, n ). +* Before entry, the leading m by n part of the array C must +* contain the matrix C, except when beta is zero, in which +* case C need not be set on entry. +* On exit, the array C is overwritten by the m by n matrix +* ( alpha*op( A )*op( B ) + beta*C ). +* +* LDC - INTEGER. +* On entry, LDC specifies the first dimension of C as declared +* in the calling (sub) program. LDC must be at least +* max( 1, m ). +* Unchanged on exit. +* +* +* Level 3 Blas routine. +*/ +/* +void dgemm_(char *TRANSA, char* TRANSB, int *M, int *N, int *K, + double *ALPHA, double *A, int *LDA, + double *B, int *LDB, double *BETA, + double *C, int *LDC);*/ + +extern int C2F(dgemm)(); +extern int C2F(idamax)() ;/* could be transcribe easaly in c */ +extern int C2F(daxpy) () ;/* could be transcribe easaly in c */ +extern int C2F(dscal) () ;/* could be transcribe easaly in c */ +extern int C2F(dasum) () ;/* could be transcribe easaly in c */ + + +#endif /* !__BLAS_H__ */ diff --git a/includes/constant.h b/includes/constant.h new file mode 100644 index 00000000..a2c0d499 --- /dev/null +++ b/includes/constant.h @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __CONSTANT_H__ +#define __CONSTANT_H__ + +#define FPI 3.1415926535897931159980f +#define DPI 3.1415926535897931159980 + +#endif /* !__CONSTANT_H__ */ + diff --git a/includes/lapack.h b/includes/lapack.h new file mode 100644 index 00000000..0bee916e --- /dev/null +++ b/includes/lapack.h @@ -0,0 +1,168 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __LAPACK_H__ +#define __LAPACK_H__ + +#ifndef _MACRO_C2F_ +#define _MACRO_C2F_ +#define C2F(name) name##_ +#endif + +#include "doubleComplex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define getRelativeMachinePrecision() dlamch_("e", 1L) +#define getOverflowThreshold() dlamch_("o", 1L) +#define getUnderflowThreshold() dlamch_("u", 1L) + +#define getOneNorm(lines,cols,in,work) dlange_("1", lines, cols, in, lines, work) +#define resolveSystemLinear(cols1,row2,cpytranIn1,pIpiv, transposeOfIn2,info) \ + dgetrs_ ("N" ,cols1, row2, cpytranIn1 , cols1, pIpiv,transposeOfIn2, cols1, info) ; + + + + +/** + * -- LAPACK auxiliary routine (version 3.0) -- + * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., + * Courant Institute, Argonne National Lab, and Rice University + * October 31, 1992 + * + * Purpose + * ======= + * + * DLAMCH determines double precision machine parameters. + * + * Arguments + * ========= + * + * CMACH (input) CHARACTER*1 + * Specifies the value to be returned by DLAMCH: + * = 'E' or 'e', DLAMCH := eps + * = 'S' or 's , DLAMCH := sfmin + * = 'B' or 'b', DLAMCH := base + * = 'P' or 'p', DLAMCH := eps*base + * = 'N' or 'n', DLAMCH := t + * = 'R' or 'r', DLAMCH := rnd + * = 'M' or 'm', DLAMCH := emin + * = 'U' or 'u', DLAMCH := rmin + * = 'L' or 'l', DLAMCH := emax + * = 'O' or 'o', DLAMCH := rmax + * + * where + * + * eps = relative machine precision + * sfmin = safe minimum, such that 1/sfmin does not overflow + * base = base of the machine + * prec = eps*base + * t = number of (base) digits in the mantissa + * rnd = 1.0 when rounding occurs in addition, 0.0 otherwise + * emin = minimum exponent before (gradual) underflow + * rmin = underflow threshold - base**(emin-1) + * emax = largest exponent before overflow + * rmax = overflow threshold - (base**emax)*(1-eps) + * + * ===================================================================== + **/ +extern double dlamch_ (char *CMACH, unsigned long int i); + +extern double dlange_ (char* NORM, int* M, int* N, double* A, int* LDA , double* WORK); + +extern double dgetrf_ (int* M, int* N , double* A , int* LDA , int* IPIV , int* INFO); + +extern double dgecon_ (char* NORM, int* N, double* A, int* LDA, double* ANORM, + double* RCOND, double* WORK , int* IWORK, int* INFO ) ; + +extern double dgetrs_ (char* TRANS, int* N, int* NRHS, double* A, int* LDA, + int* IPIV, double* B, int* LDB, int* INFO ) ; + +extern double dgelsy_ (int* M, int* N, int* NRHS, double* A, int* LDA, + double* B, int* LDB, int* JPVT, double* RCOND, int* RANK, + double* WORK, int* LWORK, int* INFO) ; + +extern double dlacpy_ (char* NORM, int* M, int* N, double* A, int* LDA, + double* B, int* LDB ); + +extern double dgetri_ (int* N , double* A , int* LDA , int* IPIV , double* WORK, + int* LWORK , int* INFO ) ; + + +/****** doubleComplex fortran function ************/ +extern double zgelsy_ (int*,int*,int*,doubleComplex*,int*,doubleComplex*,int*,int*,double*,int*,doubleComplex*,int*,double*,int*) ; + + +extern double zlamch_ (); + +extern double zlange_ (char*,int*,int*,doubleComplex*,int*,doubleComplex*); + +extern double zgetrf_ (int *, int *, doubleComplex *, int *, int *, int *); + +extern double zgecon_ ( char*,int*,doubleComplex*,int*,double*,double*,doubleComplex*,double*,int*) ; + +extern double zgetrs_ ( char *,int*,int*,doubleComplex*,int*,int*,doubleComplex*,int*,int*) ; + +extern double zlacpy_ (char*,int*,int*,doubleComplex*,int*,doubleComplex*,int*); + +extern double zgetri_ (int*,doubleComplex*,int*,int*,doubleComplex*,int*,int*) ; +/*extern int zgelsy_ ();*/ + +/*certainly have some blas functions in */ +extern int C2F(split)(); +extern int C2F(exch)(); + +extern int C2F(balbak)(); +extern double C2F(ddot)(); +extern int C2F(pade)(); +extern int C2F(dcopy)(); +extern int C2F(dscal)(); + +extern int C2F(dgeco)(); +extern int C2F(dgesl)(); +extern int C2F(coef)(); +extern int C2F(cerr)(); +extern int C2F(dclmat)(); +extern int C2F(dexpm1)(); +extern int C2F(wexpm1)(); +extern int C2F(drot)(); + +extern int C2F(intexpm) (); + +extern int C2F(zcopy)(int*,doubleComplex *,int*,doubleComplex*,int*); + +extern int C2F(dgemm)(char *,char*,int*,int*,int*,double*,double*,int*,double*,int*,double*,double*,int*); +extern int C2F(idamax)() ;/* could be transcribe easily in c */ +extern int C2F(daxpy) () ;/* could be transcribe easily in c */ +extern int C2F(dscal) () ;/* could be transcribe easily in c */ +extern int C2F(dasum) () ;/* could be transcribe easily in c */ + +/* used in chol */ +extern int C2F(dpotrf)(char*,int*,double*,int*,int*); +extern int C2F(zpotrf)(char*,int*,doubleComplex*,int*,int*); + +/* used in logm */ +extern int C2F(zgeev)(char*,char*,int*,doubleComplex*,int*,doubleComplex*, + doubleComplex*,int*,doubleComplex*,int*,doubleComplex*,int *,doubleComplex*,int*); + +extern int C2F(zheev)(char*,char*,int*,doubleComplex*,int*,double*,doubleComplex*,int*,double*,int*); + +/* used in spec */ +extern int C2F(dgeev)(char*,char*,int*,double*,int*,double*,double*,double*,int*,double*,int*,double*,int*,int*); +extern int C2F(dsyev)(char*,char*,int*,double*,int*,double*,double*,int*,int*); + +#ifdef __cplusplus +} /* extern "C" */ +#endif +#endif /* !__LAPACK_H__ */ diff --git a/includes/machine.h.in b/includes/machine.h.in new file mode 100644 index 00000000..eaa168db --- /dev/null +++ b/includes/machine.h.in @@ -0,0 +1,77 @@ +/* includes/machine.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if your Fortran compiler doesn't accept -c and -o together. */ +#undef F77_NO_MINUS_C_MINUS_O + +/* Define to 1 if you have the <complex.h> header file. */ +#undef HAVE_COMPLEX_H + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* With the Atlas Lib */ +#undef WITH_ATLAS diff --git a/includes/notFound.h b/includes/notFound.h new file mode 100644 index 00000000..2d5ee1c2 --- /dev/null +++ b/includes/notFound.h @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __NOT_FOUND_H__ +#define __NOT_FOUND_H__ + +#define NOT_FOUND -1 + +#endif /* !__NOT_FOUND_H__ */ |