NO

Author Topic: optimizer crashes 64bit beta#3  (Read 2615 times)

rko

  • Guest
optimizer crashes 64bit beta#3
« on: July 08, 2018, 04:51:37 PM »
when compiling the library, the compiler goes off into lala-land. ide has to be kill.
only happens if optimization is turned on


<<< cmt.h >>>
Code: [Select]
/*$no list*//*$no trace          <<<cmt.h>>>                          */
#include <stddef.h>               /* defines size_t data type         */
#include <stdlib.h>
#include <string.h>
#include "mathlib.h"

/* these are declarations of external variables that are accessed by
   some of the library functions but not accessed by user programs    */

extern Void_Ptr2 alloc_list;     /* address of allocated memory list */
extern int alloc_list_length;    /* length of allocated memory list  */
 
/* these are the internal math library function prototypes */
 
double      stopbnd_(double dB);
void        matherr_(char *funcname, int errnum);
Real        Cmag_(Complex_Ptr x);
Complex     Cmul_(Complex_Ptr x, Complex_Ptr y);
Real_Vector decomp_(Real_Matrix m, unsigned n);
void        lineqn_(Real_Vector b, Real_Vector work, Real_Matrix m, unsigned n);
void        wind_(Real_Vector w, size_t nw, Real coef[], size_t ncoef);
double      besi0_(double x);
Real        lagrang_(Real_Vector x, int nx, Real t, Real dt);
double      xinterp_(double p, double data[]);
size_t      f_read(Void_Ptr buffer, size_t size, size_t number, void *fp);
size_t      f_write(Void_Ptr buffer, size_t size, size_t number, void *fp);
int         add_alloc_list(Void_Ptr p);
int         remove_alloc_list(Void_Ptr p);

/*--------------------------------------------------------------------
   define constants
  --------------------------------------------------------------------*/
#define CTRL_Z 0x1a
/* SIZE_T_MAX is the maximum value of the size_t data type            */
#define SIZE_T_MAX ((size_t) ~0)
/* HUGE_MAX is the maximum value of the unsigned long data type       */
#define HUGE_MAX ((unsigned long) ~0L)
/* macros for determining maximum or minimum of two values */
#define MAX(a,b)    (((a) > (b)) ? (a) : (b))
#define MIN(a,b)    (((a) < (b)) ? (a) : (b))
 
/*--------------------------------------------------------------------
   if STDC is 1, then use only ANSI standard C features
   note: mathlib library file must be rebuilt if STDC is 1
  --------------------------------------------------------------------*/
#if STDC
#define MALLOC_MAX SIZE_T_MAX
#define ARRAY_MAX SIZE_T_MAX
 
#define HUGE_PTR *
#define PARAGRAPH 0
#define FP_SEG(fp) 0
#define FP_OFF(fp) 0
#define MK_FP(segment, offset) NULL
#define NORMALIZED(fp) (Void_Ptr) fp
 
#define MALLOC(size) malloc((size_t) size)
#define FREE(ptr) free((void *) ptr)
#define MEMCPY(dest, src, size) memcpy((void *) dest, (const void *) src, (size_t) size)
 
/* declare the functions referenced by the above macros               */
//void *malloc(size_t size);
//void free(void *ptr);
//void *memcpy(void *s1, const void *s2, size_t n);
 
/*--------------------------------------------------------------------
   else if STDC is 0, then take advantage of extended C features
  --------------------------------------------------------------------*/
#else
 
/**********************************************************************/
/* define macros for the Power C compiler                             */
/**********************************************************************/
#if defined(__POWERC)
    #define MALLOC_MAX HUGE_MAX /* maximum size that can be allocated */
    #if HUGE_OBJECT
        #define ARRAY_MAX HUGE_MAX    /* maximum size of an array     */
    #else
        #define ARRAY_MAX SIZE_T_MAX  /* maximum size of an array     */
    #endif
    #if defined(M_I86LM)
        #define LARGE_MODEL 1
    #else
        #define LARGE_MODEL 0
    #endif
 
    #define HUGE_PTR huge*
    #define PARAGRAPH 12
    #define FP_SEG(fp) (*((unsigned *)&(fp) + 1))
    #define FP_OFF(fp) (*((unsigned *)&(fp)))
    #define MK_FP(segment,offset) ((void far *) \
                       (((unsigned long)(segment) << 16) | (unsigned) (offset)))
    #define NORMALIZED(fp) (Void_Ptr) \
            (((unsigned long) (FP_SEG(fp) + (FP_OFF(fp) >> 4)) << 16) \
            | (FP_OFF(fp) & 0xF))
 
    #define MALLOC(size) farmalloc((unsigned long) size)
    #define FREE(ptr) farfree((void far *) ptr)
    #define MEMCPY(dest, src, size) movedata((unsigned) FP_SEG(src), \
                    (unsigned) FP_OFF(src), (unsigned) FP_SEG(dest), \
                    (unsigned) FP_OFF(dest), (size_t) size)
 
/* declare the functions referenced by the above macros               */
void far *farmalloc(unsigned long size);
void farfree(void far *ptr);
void movedata(int srcseg, int srcoff,
              int destseg, int destoff, unsigned size);
#endif
 
/**********************************************************************/
/* define macros for the Turbo C/C++ and Borland C/C++ compilers      */
/**********************************************************************/
#if defined(__TURBOC__)
    #define MALLOC_MAX HUGE_MAX
    #if HUGE_OBJECT
        #define ARRAY_MAX HUGE_MAX
    #else
        #define ARRAY_MAX SIZE_T_MAX
    #endif
    #if defined(M_I86LM)
        #define LARGE_MODEL 1
    #else
        #define LARGE_MODEL 0
    #endif
 
    #define HUGE_PTR huge*
    #define PARAGRAPH 12
    #define FP_SEG(fp) (*((unsigned *)&(fp) + 1))
    #define FP_OFF(fp) (*((unsigned *)&(fp)))
    #define MK_FP(segment,offset) ((void far *) \
                       (((unsigned long)(segment) << 16) | (unsigned) (offset)))
    #define NORMALIZED(fp) (Void_Ptr) \
            (((unsigned long) (FP_SEG(fp) + (FP_OFF(fp) >> 4)) << 16) \
            | (FP_OFF(fp) & 0xF))
 
    #define MALLOC(size) farmalloc((unsigned long) size)
    #define FREE(ptr) farfree((void far *) ptr)
    #define MEMCPY(dest, src, size) movedata((unsigned) FP_SEG(src), \
                    (unsigned) FP_OFF(src), (unsigned) FP_SEG(dest), \
                    (unsigned) FP_OFF(dest), (size_t) size)
 
/* declare the functions referenced by the above macros               */
void far *farmalloc(unsigned long size);
void farfree(void far *ptr);
void movedata(unsigned srcseg, unsigned srcoff,
              unsigned destseg, unsigned destoff, unsigned size);
#endif
 
/**********************************************************************/
/* define macros for QuickC and Microsoft C compilers                 */
/**********************************************************************/
#if defined(_QC) || defined(_CL)
    #define MALLOC_MAX HUGE_MAX
    #if HUGE_OBJECT
        #define ARRAY_MAX (HUGE_MAX-1)
    #else
        #define ARRAY_MAX SIZE_T_MAX
    #endif
    #if defined(M_I86LM)
        #define LARGE_MODEL 1
    #else
        #define LARGE_MODEL 0
    #endif

    #define HUGE_PTR huge*
    #define PARAGRAPH 12
    #define FP_SEG(farptr) (*((unsigned *)&(farptr) + 1))
    #define FP_OFF(farptr) (*((unsigned *)&(farptr)))
    #define MK_FP(segment,offset) ((void far *) \
                       (((unsigned long)(segment) << 16) | (unsigned) (offset)))
    #define NORMALIZED(fp) (Void_Ptr) \
            (((unsigned long) (FP_SEG(fp) + (FP_OFF(fp) >> 4)) << 16) \
            | (FP_OFF(fp) & 0xF))
 
    #define MALLOC(size) halloc((long) size, (size_t) 1)
    #define FREE(ptr) hfree((void huge *) ptr)
    #define MEMCPY(dest, src, size) movedata((unsigned) FP_SEG(src), \
        (unsigned) FP_OFF(src), (unsigned) FP_SEG(dest), \
        (unsigned) FP_OFF(dest), (size_t) size)
 
/* declare the functions referenced by the above macros               */
void huge *halloc(long size, size_t number);
void hfree(void huge *ptr);
void movedata(unsigned srcseg, unsigned srcoff, unsigned destseg, unsigned destoff, unsigned size);
#endif
#endif
/*$list*//*$trace                <<< cmt.h >>>                        */


Code: [Select]
/*---------------------------fft42.c----------------------------------------*/
#include "cmt.h"
#include <math.h>
#include <stdlib.h>
void fft42(Complex_Vector data, unsigned n, int isign)
{
/*
  subroutine performs an n-point, radix "4+2" Cooley-Tukey fft on complex array
  "data". This routine is about twice as fast as the standard radix-2 approach.
 
  n     must be a power of two
data[]  is the complex input array, and, on exit, it is also the complex
        output array (i.e. the input is destroyed)
  forward transform ==> isgn=-1
  inverse transform ==> isgn=+1
 
*/
 
size_t nm1,ndv2,j,ipar,mmax,lmax,kmin,kdif,kstep,k1,k2,k3,k4;
size_t k,l,m;
double tempr=0.0,tempi=0.0,theta=0.0,wr=0.0,wi=0.0,wstpr=0.0,wstpi=0.0,w2r=0.0,w2i=0.0,w3r=0.0,w3i=0.0,fn=0.0;
double u1r,u1i,u2r,u2i,u3r,u3i,u4r,u4i,t2r,t2i,t3r,t3i,t4r,t4i;
 
unsigned lfft;
char *fname = "fft42";
 
        if(data == NULL) {
             matherr_("fname", E_NULLPTR);
             return;
        }
/*   see if fft length, n, is a power of two   */
        m = (unsigned) ceil(log((double) n)/0.693147181);
        lfft = 2;
        for(j=1; j<m; j++) lfft += lfft;

        if(lfft != n) {
             matherr_(fname, E_FFTPOWER2);
             return;
        }
 
        /* m = log2 (n)  */
 
        nm1=n-1;
        wr = wi = wstpr = wstpi = 0.0;
        ndv2 = n>>1;
        j=0;
        for (k=0; k < nm1; k++) {
              if (k < j) {      /* bit reversal stage  */
                   tempr=data[j].r;
                   tempi=data[j].i;
                   data[j].r=data[k].r;
                   data[j].i=data[k].i;
                   data[k].r=(Real)tempr;
                   data[k].i=(Real)tempi;
              }
              m=ndv2;
              while (m < j+1) { j -= m; m >>= 1; }
              j += m;
        }
        ipar=n;
        while (ipar > 2) ipar >>= 2;
        if (ipar == 2) {
            for (k1=0; k1<=nm1; k1+=2) {
                 k2=k1+1;
                 tempr=data[k2].r;
                 tempi=data[k2].i;
                 data[k2].r=data[k1].r-tempr;
                 data[k2].i=data[k1].i-tempi;
                 data[k1].r=data[k1].r+tempr;
                 data[k1].i=data[k1].i+tempi;
            }
        }
        mmax=2;
        while (mmax < n) {
            lmax=MAX(4,(mmax >> 1));
            if(mmax > 2) {
                theta=-pi_/mmax;
                if(isign >= 0) theta=-theta;
                wr=cos(theta);
                wi=sin(theta);
                wstpr=-2.0*wi*wi;
                wstpi=2.0*wr*wi;
            }
            for (l=2; l<=lmax; l+=4) {
                 m=l;
                 if(mmax > 2) {
zero:
                     w2r=wr*wr-wi*wi;
                     w2i=2.0*wr*wi;
                     w3r=w2r*wr-w2i*wi;
                     w3i=w2r*wi+w2i*wr;
                 }
                 kmin=ipar*m; kmin >>= 1;
                 if(mmax <= 2) kmin = 0;
                 kdif=ipar*mmax; kdif >>= 1;
five:
                 kstep = (kdif << 2);
                 for (k1=kmin; k1<=nm1; k1+=kstep) {
                      k2=k1+kdif;
                      k3=k2+kdif;
                      k4=k3+kdif;
                      if(mmax <= 2) {
                          u1r=data[k1].r+data[k2].r;
                          u1i=data[k1].i+data[k2].i;
                          u2r=data[k3].r+data[k4].r;
                          u2i=data[k3].i+data[k4].i;
                          u3r=data[k1].r-data[k2].r;
                          u3i=data[k1].i-data[k2].i;
                          if(isign < 0) {
                              u4r=data[k3].i-data[k4].i;
                              u4i=data[k4].r-data[k3].r;
                              goto ten;
                          }
                          u4r=data[k4].i-data[k3].i;
                          u4i=data[k3].r-data[k4].r;
                          goto ten;
                      }
                      t2r=w2r*data[k2].r-w2i*data[k2].i;
                      t2i=w2r*data[k2].i+w2i*data[k2].r;
                      t3r=wr*data[k3].r-wi*data[k3].i;
                      t3i=wr*data[k3].i+wi*data[k3].r;
                      t4r=w3r*data[k4].r-w3i*data[k4].i;
                      t4i=w3r*data[k4].i+w3i*data[k4].r;
                      u1r=data[k1].r+t2r;
                      u1i=data[k1].i+t2i;
                      u2r=t3r+t4r;
                      u2i=t3i+t4i;
                      u3r=data[k1].r-t2r;
                      u3i=data[k1].i-t2i;
                      if(isign < 0) {
                          u4r=t3i-t4i;
                          u4i=t4r-t3r;
                          goto ten;
                      }
                      u4r=t4i-t3i;
                      u4i=t3r-t4r;
ten:
                      data[k1].r=(Real)u1r+u2r;
                      data[k1].i=(Real)u1i+u2i;
                      data[k2].r=(Real)u3r+u4r;
                      data[k2].i=(Real)u3i+u4i;
                      data[k3].r=(Real)u1r-u2r;
                      data[k3].i=(Real)u1i-u2i;
                      data[k4].r=(Real)u3r-u4r;
                      data[k4].i=(Real)u3i-u4i;
                 }
                 kmin = (kmin << 2);
                 kdif = kstep;
                 if(kdif-n) goto five;
                 m=mmax-m;
                 if(isign < 0) {
                     tempr=wr;
                     wr=-wi;
                     wi=-tempr;
                     goto fifteen;
                 }
                 tempr=wr;
                 wr=wi;
                 wi=tempr;
fifteen:
                 if(m > lmax) goto zero;
                 tempr=wr;
                 wr=wr*wstpr-wi*wstpi+wr;
                 wi=wi*wstpr+tempr*wstpi+wi;
            }
            ipar=3-ipar;
            mmax += mmax;
        }
        if(isign < 0) return;
        fn = 1.0/n;
        for (k=0; k < n; k++) { data[k].r *= fn;    data[k].i *= fn;}
}
« Last Edit: July 08, 2018, 07:56:00 PM by TimoVJL »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: optimizer crashes 64bit beta#3
« Reply #1 on: July 08, 2018, 06:08:35 PM »
Without mathlib.h this example goes to lala-land too ;)
Just kill the compiler from task manager, Stop build doesn't work :(

The test using fake mathlib.h hangs too.
Code: [Select]
typedef double Real;
typedef struct {
double r;
double i;
}*Complex_Vector;
#define pi_ 3.14
#define E_NULLPTR 0
#define E_FFTPOWER2 0
#define MAX(a,b)    (((a) > (b)) ? (a) : (b))
« Last Edit: July 08, 2018, 06:21:15 PM by TimoVJL »
May the source be with you

rko

  • Guest
Re: optimizer crashes 64bit beta#3
« Reply #2 on: July 08, 2018, 07:43:46 PM »
sorry - i kind of forgot it. find it below.


part 1

Code: [Select]
/*$no list*//*$no trace          <<<mathlib.h>>>                      */
 
/*--------------------------------------------------------------------
   define REAL as double
   valid values for REAL: float or double
   note: mathlib library files must be rebuilt if REAL is changed
  --------------------------------------------------------------------*/
#define REAL double

/*--------------------------------------------------------------------
   define STDC as 0 (allows use of non-standard C features)
   valid values for STDC: 0 or 1
   note: set STDC to 1 if your compiler does not support far or huge
         mathlib library files must be rebuilt if this is changed
  --------------------------------------------------------------------*/
#define STDC 1
 
/*--------------------------------------------------------------------
   if STDC is 0, then take advantage of extended C features
   define OBJECT as far, FAR_OBJECT as 1, and HUGE_OBJECT as 0
   valid values for      OBJECT: far or huge
   valid values for  FAR_OBJECT:   0 or 1
   valid values for HUGE_OBJECT:   0 or 1
   note: mathlib library files must be rebuilt if any of these values
         are changed.  FAR_OBJECT should be set to 1 if OBJECT is set
         to far, otherwise 0. HUGE_OBJECT should be set to 1 if OBJECT
         is set to huge, otherwise 0.
  --------------------------------------------------------------------*/
#if !STDC
#define OBJECT far
#define FAR_OBJECT 1
#define HUGE_OBJECT 0
 
/*--------------------------------------------------------------------
   else if STDC is 1, then use only ANSI standard C
   define OBJECT as <null>, FAR_OBJECT as 0, and HUGE_OBJECT as 0
   note: do not change any of these values
  --------------------------------------------------------------------*/
#else
#define OBJECT
#define FAR_OBJECT 0
#define HUGE_OBJECT 0
#endif
 
/*--------------------------------------------------------------------
   define macros
  --------------------------------------------------------------------*/
#define OFF        0
#define ON         1

#define XY_ASCII   0
#define XY_BINARY  1
#define XYY_ASCII  2
#define XYY_BINARY 3
 
#define HEADER_MAX  512
#define TITLE_MAX    30
#define AXIS_MAX     30
#define LABEL_MAX    20
#define CURVES_MAX    5
/*--------------------------------------------------------------------
   define data types
  --------------------------------------------------------------------*/
#ifndef MATHLIB_H
#define MATHLIB_H
typedef REAL Real;
typedef struct {Real r; Real i;} Complex;
typedef Real OBJECT* Real_Vector;
typedef Real_Vector OBJECT* Real_Matrix;
typedef Complex OBJECT* Complex_Vector;
typedef Complex_Vector OBJECT* Complex_Matrix;
typedef void OBJECT* Void_Ptr;
typedef Void_Ptr OBJECT* Void_Ptr2;
typedef unsigned char OBJECT* Byte_Ptr;
typedef Byte_Ptr OBJECT* Byte_Ptr2;
typedef Real OBJECT* Real_Ptr;
typedef Real_Ptr OBJECT* Real_Ptr2;
typedef Complex OBJECT* Complex_Ptr;
typedef Complex_Ptr OBJECT* Complex_Ptr2;
typedef struct {
            char title[TITLE_MAX+1];
            char xaxis[AXIS_MAX+1];
            char yaxis[AXIS_MAX+1];
            char curve[CURVES_MAX][LABEL_MAX+1];
        } Labels;
#endif
 
/*--------------------------------------------------------------------
   declare variables
  --------------------------------------------------------------------*/
extern Real determ_;
extern Complex Cdeterm_;
extern int useinput_;
extern int math_errno;
extern int math_errmsg;
extern char *math_errs[];
extern int math_abort;
extern int math_digits;
extern int math_linesize;
 
/* numerical constants */
extern double pi_;
extern double twopi_;
extern double e_;
extern double sqrt2_;
extern double sqrt3_;
extern double euler_;
 
#ifdef __cplusplus
extern "C" {
#endif

/*--------------------------------------------------------------------
   declare functions
  --------------------------------------------------------------------*/
__declspec(dllexport) void           math_err(void);
__declspec(dllexport) int            mathfree(void);
            /***************************************************/
            /*          Complex Arithmetic functions           */
            /***************************************************/
__declspec(dllexport) Complex        Cadd(Complex x, Complex y);
__declspec(dllexport) Complex        Cmul(Complex x, Complex y);
__declspec(dllexport) Complex        Cdiv(Complex x, Complex y);
__declspec(dllexport) Complex        Csub(Complex x, Complex y);
__declspec(dllexport) Complex        Complx(Real x, Real y);
__declspec(dllexport) Real           Cmag(Complex x);
__declspec(dllexport) Complex        Csqrt(Complex x);
__declspec(dllexport) Complex        Conjg(Complex x);
__declspec(dllexport) Complex        CscalR(Complex x, Real y);
            /***************************************************/
            /*   Complex Matrix and Complex Vector functions   */
            /***************************************************/
__declspec(dllexport) Complex_Vector Clineqn(Complex_Matrix m, Complex_Vector v, unsigned n);
__declspec(dllexport) Complex_Matrix Cmxalloc(Complex_Ptr address, unsigned rows, unsigned cols);
__declspec(dllexport) void           Cmxcopy(Complex_Matrix dest, Complex_Matrix src,unsigned rows, unsigned cols);
__declspec(dllexport) Complex_Matrix Cmxconjg(Complex_Matrix m, unsigned rows, unsigned cols);
__declspec(dllexport) Complex        Cmxdeter(Complex_Matrix m, unsigned n);
__declspec(dllexport) Complex_Matrix Cmxdup(Complex_Matrix m, unsigned rows, unsigned cols);
__declspec(dllexport) void           Cmxfree(Complex_Matrix m);
__declspec(dllexport) void           Cmxinit(Complex_Matrix m, unsigned rows, unsigned cols,Complex value);
__declspec(dllexport) Complex_Matrix Cmxinv(Complex_Matrix m, unsigned n);
__declspec(dllexport) Complex_Matrix Cmxinv22(Complex_Matrix m);
__declspec(dllexport) Complex_Matrix Cmxinv33(Complex_Matrix m);
__declspec(dllexport) Real           Cmxmaxvl(Complex_Matrix m, unsigned rows, unsigned cols,unsigned *imx, unsigned *jmx);
__declspec(dllexport) Real           Cmxminvl(Complex_Matrix m, unsigned rows, unsigned cols,unsigned *imn, unsigned *jmn);
__declspec(dllexport) Complex_Matrix Cmxmul(Complex_Matrix m1, Complex_Matrix m2, unsigned n1,unsigned n2, unsigned n3);
__declspec(dllexport) Complex_Matrix Cmxmul1(Complex_Matrix m1, Complex_Matrix m2, unsigned n1,unsigned n2, unsigned n3);
__declspec(dllexport) Complex_Matrix Cmxmul2(Complex_Matrix m1, Complex_Matrix m2, unsigned n1,unsigned n2, unsigned n3);
__declspec(dllexport) Complex_Matrix Cmxadd(Complex_Matrix m1, Complex_Matrix m2, unsigned rows,unsigned cols);
__declspec(dllexport) Complex_Matrix CmxscalC(Complex_Matrix m, unsigned rows, unsigned cols,Complex value);
« Last Edit: July 08, 2018, 07:57:32 PM by TimoVJL »

rko

  • Guest
Re: optimizer crashes 64bit beta#3
« Reply #3 on: July 08, 2018, 07:44:55 PM »
part 2

Code: [Select]
__declspec(dllexport) Complex_Matrix CmxscalR(Complex_Matrix m, unsigned rows, unsigned cols,Real value);
__declspec(dllexport) Real_Matrix    Cmxmag(Complex_Matrix m, unsigned rows, unsigned cols);
__declspec(dllexport) Complex_Matrix Cmxsub(Complex_Matrix m1, Complex_Matrix m2, unsigned rows,unsigned cols);
__declspec(dllexport) Complex_Matrix Cmxtrans(Complex_Matrix m, unsigned rows, unsigned cols);
__declspec(dllexport) Complex        Cmxtrace(Complex_Matrix m, unsigned n);
__declspec(dllexport) Real_Vector    Cvmag(Complex_Vector v, unsigned n);
__declspec(dllexport) Complex_Vector Cvadd(Complex_Vector v1, Complex_Vector v2, unsigned n);
__declspec(dllexport) Complex_Vector Cvalloc(Complex_Ptr address, unsigned n);
__declspec(dllexport) Complex_Matrix Cvectomx(Complex_Vector v1, Complex_Vector v2, unsigned n);
__declspec(dllexport) Complex_Vector Cvconjg(Complex_Vector v, unsigned n);
__declspec(dllexport) void           Cvcopy(Complex_Vector dest, Complex_Vector src,unsigned n);
__declspec(dllexport) Complex_Vector Cvdup(Complex_Vector v, unsigned n);
__declspec(dllexport) void           Cvfree(Complex_Vector v);
__declspec(dllexport) void           Cvinit(Complex_Vector v, unsigned n, Complex value);
__declspec(dllexport) Real           Cvmaxval(Complex_Vector v, unsigned n, unsigned *imx);
__declspec(dllexport) Real           Cvminval(Complex_Vector v, unsigned n, unsigned *imn);
__declspec(dllexport) Complex_Vector Cvmxmul(Complex_Matrix m, Complex_Vector v, unsigned n1,unsigned n2);
__declspec(dllexport) Complex_Vector Cvmxmul1(Complex_Matrix m, Complex_Vector v, unsigned n1,unsigned n2);
__declspec(dllexport) Complex_Vector CvscalC(Complex_Vector v, unsigned n, Complex value);
__declspec(dllexport) Complex_Vector CvscalR(Complex_Vector v, unsigned n, Real value);
__declspec(dllexport) Complex_Vector Cvsub(Complex_Vector v1, Complex_Vector v2, unsigned n);
__declspec(dllexport) Complex_Vector Cvread(void *fp, unsigned n);
__declspec(dllexport) int            Cvwrite(void *fp, Complex_Vector v, unsigned n);
            /********************************************/
            /*   Real Matrix and Real Vector functions  */
            /********************************************/
__declspec(dllexport) Real_Vector least_sq(int (*funct)(Real, Real_Vector, unsigned), Real_Vector vx,Real_Vector vy, unsigned n, unsigned terms, Real *mse);
__declspec(dllexport) Real_Vector curvreg(Real_Vector vx, Real_Vector vy, unsigned n, unsigned terms,Real *mse);
__declspec(dllexport) Real_Vector lineqn(Real_Matrix m, Real_Vector v, unsigned n);
__declspec(dllexport) Real_Matrix mxalloc(Real_Ptr address, unsigned rows, unsigned cols);
__declspec(dllexport) void        mxcopy(Real_Matrix dest, Real_Matrix src,unsigned rows, unsigned cols);
__declspec(dllexport) Real        mxdeterm(Real_Matrix m, unsigned n);
__declspec(dllexport) Real_Matrix mxdup(Real_Matrix m, unsigned rows, unsigned cols);
__declspec(dllexport) void        mxfree(Real_Matrix m);
__declspec(dllexport) Real_Matrix mxident(unsigned n);
__declspec(dllexport) void        mxinit(Real_Matrix m, unsigned rows, unsigned cols, Real value);
__declspec(dllexport) Real_Matrix mxinv(Real_Matrix m, unsigned n);
__declspec(dllexport) Real_Matrix mxinv22(Real_Matrix m);
__declspec(dllexport) Real_Matrix mxinv33(Real_Matrix m);
__declspec(dllexport) Real        mxmaxval(Real_Matrix m, unsigned rows, unsigned cols,unsigned *imx, unsigned *jmx);
__declspec(dllexport) Real        mxminval(Real_Matrix m, unsigned rows, unsigned cols,unsigned *imn, unsigned *jmn);
__declspec(dllexport) Real_Matrix mxmul(Real_Matrix m1, Real_Matrix m2, unsigned n1, unsigned n2,unsigned n3);
__declspec(dllexport) Real_Matrix mxmul1(Real_Matrix m1, Real_Matrix m2, unsigned n1, unsigned n2,unsigned n3);
__declspec(dllexport) Real_Matrix mxmul2(Real_Matrix m1, Real_Matrix m2, unsigned n1, unsigned n2,unsigned n3);
__declspec(dllexport) Real_Matrix mxadd(Real_Matrix m1, Real_Matrix m2, unsigned rows, unsigned cols);
__declspec(dllexport) Real_Matrix mxscale(Real_Matrix m, unsigned rows, unsigned cols, Real value);
__declspec(dllexport) Real_Matrix mxsub(Real_Matrix m1, Real_Matrix m2, unsigned rows, unsigned cols);
__declspec(dllexport) Real_Matrix mxtransp(Real_Matrix m, unsigned rows, unsigned cols);
__declspec(dllexport) Real        mxtrace(Real_Matrix m, unsigned n);
__declspec(dllexport) double      pseries(double x, double coef[], unsigned n);
__declspec(dllexport) double      chebser(double x, double coef[], unsigned n, int even);
__declspec(dllexport) Real_Vector pseudinv(Real_Matrix m, Real_Vector v, unsigned neqns,unsigned unknwns);
__declspec(dllexport) Real_Vector vadd(Real_Vector v1, Real_Vector v2, unsigned n);
__declspec(dllexport) Real_Vector valloc(Real_Ptr address, unsigned n);
__declspec(dllexport) Real_Matrix vectomat(Real_Vector v1, Real_Vector v2, unsigned n);
__declspec(dllexport) void        vcopy(Real_Vector dest, Real_Vector src, unsigned n);
__declspec(dllexport) Real_Vector vcross(Real_Vector v1, Real_Vector v2);
__declspec(dllexport) Real        vdot(Real_Vector v1, Real_Vector v2, unsigned n);
__declspec(dllexport) Real_Vector vdup(Real_Vector v, unsigned n);
__declspec(dllexport) void        vfree(Real_Vector v);
__declspec(dllexport) void        vinit(Real_Vector v, unsigned n, Real value);
__declspec(dllexport) Real        vmag(Real_Vector v, unsigned n);
__declspec(dllexport) Real        vmaxval(Real_Vector v, unsigned n, unsigned *imx);
__declspec(dllexport) Real        vminval(Real_Vector v, unsigned n, unsigned *imn);
__declspec(dllexport) Real_Vector vmxmul(Real_Matrix m, Real_Vector x, unsigned n1, unsigned n2);
__declspec(dllexport) Real_Vector vmxmul1(Real_Matrix m, Real_Vector v, unsigned n1, unsigned n2);
__declspec(dllexport) Real_Vector vscale(Real_Vector in, unsigned n, Real value);
__declspec(dllexport) Real_Vector vsub(Real_Vector v1, Real_Vector v2, unsigned n);
__declspec(dllexport) Real_Vector vread(void *fp, unsigned n);
__declspec(dllexport) int         vwrite(void *fp, Real_Vector v, unsigned n);
__declspec(dllexport) int         xyinfo(char *filename, int *format, int *curves, unsigned points[],Labels *labels, int *size);
__declspec(dllexport) int         xyread(char *filename, int *format, int *curves, unsigned points[],Labels *labels, Real_Vector x[], Real_Vector y[]);
__declspec(dllexport) int         xywrite(char *filename, int format, int curves, unsigned points[],Labels *labels, Real_Vector x[], Real_Vector y[]);
__declspec(dllexport) Real_Vector tdwindow(unsigned nw, unsigned wtype);
__declspec(dllexport) double      besj0(double x);
__declspec(dllexport) double      besj1(double x);
__declspec(dllexport) double      besjn(int n, double x);
__declspec(dllexport) double      besy0(double x);
__declspec(dllexport) double      besy1(double x);
__declspec(dllexport) double      besyn(int n, double x);
__declspec(dllexport) double      beskn(int n, double x);
__declspec(dllexport) double      besin(int n, double x);
__declspec(dllexport) double      besk0(double x);
__declspec(dllexport) double      besk1(double x);
__declspec(dllexport) double      besi0(double x);
__declspec(dllexport) double      besi1(double x);
//double      acosh(double x);
//double      asinh(double x);
//double      atanh(double x);
__declspec(dllexport) double      logn(int n, double x);
__declspec(dllexport) double      combin(int n, int r);
__declspec(dllexport) double      permut(int n, int r);
__declspec(dllexport) double      fact(unsigned n);
__declspec(dllexport) double      normal(double sigma, double u);
__declspec(dllexport) unsigned    poisson(int pmean);
__declspec(dllexport) double      urand(void);
__declspec(dllexport) void        uraninit(long seed);
__declspec(dllexport) void        linreg(Real_Vector x, Real_Vector y, int n, Real *m, Real *b, Real *rsq);
__declspec(dllexport) double      stats(Real_Vector x, int n, double *pop_var, double *samp_var);
__declspec(dllexport) Real_Vector deriv(Real_Vector fx, Real dx, int n);
__declspec(dllexport) double      deriv1(double(*fx)(double), double x, double dx);
__declspec(dllexport) Real_Vector convolve(Real_Vector data, int ndata, Real weights[], int nweights, int ndec, int itype, int isym, int *length);
__declspec(dllexport) void        lowpass(Real weights[], int nweights, double fc, double dB, int half);
__declspec(dllexport) void        highpass(Real weights[], int nweights, double fc, double dB,int half);
__declspec(dllexport) void        bandpass(Real weights[], int nweights, double fh, double fl,double dB, int half);
__declspec(dllexport) Real_Vector smooth(Real_Vector data, int ndata, int factor);
__declspec(dllexport) Real_Vector downsamp(Real_Vector data, int ndata, int ndec);
__declspec(dllexport) Real_Vector integrat(Real_Vector fx, double dx, int n);
__declspec(dllexport) double      romberg(double(*fx)(double), double x0, double x1,double accuracy);
__declspec(dllexport) Real_Vector interp(Real_Vector y, int ny, int nout, Real_Vector points);
__declspec(dllexport) Real        interp1(Real x0, Real_Vector x, Real_Vector y, unsigned n,unsigned order);
__declspec(dllexport) Real_Vector spline0(Real_Vector x, Real_Vector y, unsigned n);
__declspec(dllexport) Real        spline(Real x0, Real_Vector x, Real_Vector y, unsigned n,Real_Vector deriv);
__declspec(dllexport) double      newton(double (*fx)(double), double *x, double delta,unsigned limit, double err);
__declspec(dllexport) Real        conjgrad(Real (*funct)(unsigned, Real_Vector, Real_Vector),unsigned n, Real_Vector v, Real est, Real eps,unsigned limit);
__declspec(dllexport) double      nprob(double x0);
__declspec(dllexport) double      invprob(double p0);
__declspec(dllexport) double      poissdst(int k0, double lt, Real pb[]);
__declspec(dllexport) double      binomdst(int n, int k0, double p, Real pb[]);
__declspec(dllexport) double      hyperdst(int n, int k0, int r, int r1, Real pb[]);
__declspec(dllexport) Real_Vector powspec(Real_Vector v, unsigned nv, unsigned npw, Real_Vector w);
__declspec(dllexport) Real_Vector Cpowspec(Complex_Vector v, unsigned nv, unsigned npw,Real_Vector w);
__declspec(dllexport) void        fftrad2(Complex_Vector data, unsigned n, int isign);
__declspec(dllexport) void        fft42(Complex_Vector data, unsigned n, int isign);
/* add additional function declarations here */
 
#ifdef __cplusplus
}
#endif

/*--------------------------------------------------------------------
   define error constants (0 .. n)
   change matherr_.c when new error constants are added
  --------------------------------------------------------------------*/
#define E_NOERROR     0  /* No errors detected */
#define E_MALLOC      1  /* Not enough memory */
#define E_MSIZE       2  /* Array too large */
#define E_NULLPTR     3  /* NULL pointer (uninitialized pointer ) */
#define E_MSING       4  /* Singular Matrix (ie. determinant = 0) */
#define E_NEQNS       5  /* More unknowns than equations */
#define E_WINDOW      6  /* Invalid window type specified */
#define E_DOMERR      7  /* argument outside domain of function */
#define E_FACTOR      8  /* Argument 'factor' must be between 2 and 10 */
#define E_DECIMATE    9  /* Argument 'ndec' must be between 2 and 10 */
#define E_NOTENOUGH  10  /* Not enough input data,the input array must be longer*/
#define E_INTERP     11  /* Interpolated length must be >= input length */
#define E_LAGRANGE   12  /* Interpolation not defined at input value t */
#define E_NEGPROB    13  /* Negative probability undefined */
#define E_FFTSIZE    14  /* Data length must be >= FFT length */
#define E_FFTPOWER2  15  /* FFT length must be a power of two */
#define E_LIMITS     16  /* Limits on definite integral must be distinct */
#define E_ROUNDOFF   17  /* Rounding errors prohibit required accuracy */
#define E_STEPSIZE   18  /* Step size must be nonzero to estimate derivative*/
#define E_DISCRETE   19  /* k0 must be less than total number of objects n */
#define E_SAMEX      20  /* The input table has two identical x values */
#define E_ORDER      21  /* The polynomial order must be between 1 and 9 */
#define E_OPEN       22  /* Could not open file */
#define E_WRITE      23  /* Error writing to file */
#define E_READ       24  /* Error reading from file */
#define E_CURVES     25  /* Argument 'curves' must be between 1 and 9 */
#define E_HEADER     26  /* Invalid file header */
#define E_RSIZE      27  /* Sizeof(Real) in file != sizeof(Real) in program */
#define E_NO_MIN     28  /* Minimum probably does not exist */
#define E_DIVERGE    29  /* No convergence in LIMIT iterations */
#define E_GRAD_ERR   30  /* Encountered errors in calculating the gradient */
#define E_USERFUNC   31  /* User function called by least_sq returned error */
/* add additional error constants here */
 
/*$list*//*$trace                <<< mathlib.h >>>                    */
« Last Edit: July 08, 2018, 07:58:13 PM by TimoVJL »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: optimizer crashes 64bit beta#3
« Reply #4 on: July 08, 2018, 08:03:16 PM »
Please use code tags #.
May the source be with you