Revision 461

branches/gpu/newfmin.cpp (revision 461)
1
/*
2
*
3
 * $Id: newfmin.cpp 1001 2011-04-07 22:36:54Z johnoel $
4
 *
5
 * Author: Unknown
6
 * Copyright (c) 2009-2011 ADMB Foundation
7
 *
8
 * This file was originally written in FORTRAN II by and unknown author.
9
 * In the 1980s, it was ported to C and C++ and extensively modified by
10
 * David Fournier. 
11
 *
12
 */
13
/**
14
 * \file
15
 * newfmin by Dave Fournier including new BFGS algorithm and GPU calculations
16
 */
17
#ifdef __APPLE__
18
#include <OpenCL/opencl.h>
19
#else
20
#include <CL/cl.h>
21
#endif
22

  
23
// next line added by Ian Taylor to kill Visual C++ warning about 
24
// "not all control paths return a value"
25
#pragma warning(default:4716)
26

  
27
#include <fvar.hpp>
28
#if defined(__SPDLL__)
29
#  if !defined(linux)
30
#    include <windows.h>
31
#  endif
32
#include <admodel.h>
33
#include <s.h>
34
#include <newredef.h>
35
#endif
36
#if defined(__BORLANDC__)
37
  #include <signal.h>
38
#endif
39
#ifdef __ZTC__
40
  #include <conio.h>
41
#endif
42
#ifdef __GNUDOS__
43
  #define ADGETCH getch
44
#endif
45
#include <fvar.hpp>
46
extern int ctlc_flag;
47
#if defined(__TURBOC__) && defined(__linux__)
48
  void clrscr(void);
49
#endif
50
#if defined(__TURBOC__) && !defined(__linux__)
51
  #pragma hdrstop
52
  #include <iostream.h>
53
  #include <conio.h>
54
#endif
55
#if defined (__WAT32__) || defined (__MSVC32__) 
56
  #include <conio.h>
57
#endif
58
#if defined(__CYGWIN__)
59
  int kbhit(void)
60
  {
61
    return 0;
62
  }
63
#endif
64
#ifdef __ZTC__
65
  #include <iostream.hpp>
66
  #include <disp.h>
67
  #define endl "\n"
68
  void clrscr(void);
69
#endif
70
#ifdef __SUN__
71
  #define getch getchar
72
  void clrscr(void); 
73
#endif
74
#if defined(__GNU__) || defined(UNIXKLUDGE)
75
  #define getch getchar
76
#endif
77
  #include <signal.h>
78
  extern "C" void onintr(int k)
79
  {
80
    signal(SIGINT, exit_handler);
81
    ctlc_flag = 1;
82
    if (ad_printf) (*ad_printf)("\npress q to quit or c to invoke derivative checker: ");
83
  }
84
#ifdef __NDPX__
85
  #include <iostream.hxx>
86
  extern "C" {
87
    void clrscr();
88
  };
89
#endif
90
#if defined (__MSVC32__)
91
  void __cdecl clrscr(void);
92
#endif
93
#include <math.h>
94
#include <stdlib.h>
95
#include <stdio.h>
96
#include <ctype.h>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff