| 1 | ///////////////////////////////////////////////////////////////////////////////// | 
|---|
| 2 | // | 
|---|
| 3 | //  Levenberg - Marquardt non-linear minimization algorithm | 
|---|
| 4 | //  Copyright (C) 2004  Manolis Lourakis (lourakis at ics forth gr) | 
|---|
| 5 | //  Institute of Computer Science, Foundation for Research & Technology - Hellas | 
|---|
| 6 | //  Heraklion, Crete, Greece. | 
|---|
| 7 | // | 
|---|
| 8 | //  This program is free software; you can redistribute it and/or modify | 
|---|
| 9 | //  it under the terms of the GNU General Public License as published by | 
|---|
| 10 | //  the Free Software Foundation; either version 2 of the License, or | 
|---|
| 11 | //  (at your option) any later version. | 
|---|
| 12 | // | 
|---|
| 13 | //  This program is distributed in the hope that it will be useful, | 
|---|
| 14 | //  but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 15 | //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 16 | //  GNU General Public License for more details. | 
|---|
| 17 | // | 
|---|
| 18 | ///////////////////////////////////////////////////////////////////////////////// | 
|---|
| 19 |  | 
|---|
| 20 | #ifndef _COMPILER_H_ | 
|---|
| 21 | #define _COMPILER_H_ | 
|---|
| 22 |  | 
|---|
| 23 | /* note: intel's icc defines both __ICC & __INTEL_COMPILER. | 
|---|
| 24 | * Also, some compilers other than gcc define __GNUC__, | 
|---|
| 25 | * therefore gcc should be checked last | 
|---|
| 26 | */ | 
|---|
| 27 | #ifdef _MSC_VER | 
|---|
| 28 | #define inline __inline // MSVC | 
|---|
| 29 | #elif !defined(__ICC) && !defined(__INTEL_COMPILER) && !defined(__GNUC__) | 
|---|
| 30 | #define inline // other than MSVC, ICC, GCC: define empty | 
|---|
| 31 | #endif | 
|---|
| 32 |  | 
|---|
| 33 | #ifdef _MSC_VER | 
|---|
| 34 | #define LM_FINITE _finite // MSVC | 
|---|
| 35 | #elif defined(__ICC) || defined(__INTEL_COMPILER) || defined(__GNUC__) | 
|---|
| 36 | #define LM_FINITE finite // ICC, GCC | 
|---|
| 37 | #else | 
|---|
| 38 | #define LM_FINITE finite // other than MSVC, ICC, GCC, let's hope this will work | 
|---|
| 39 | #endif | 
|---|
| 40 |  | 
|---|
| 41 | #ifdef _MSC_VER | 
|---|
| 42 | #define LM_ISINF(x) (!_finite(x) && !_isnan(x)) // MSVC | 
|---|
| 43 | #elif defined(__ICC) || defined(__INTEL_COMPILER) || defined(__GNUC__) | 
|---|
| 44 | #define LM_ISINF(x) isinf(x) // ICC, GCC | 
|---|
| 45 | #else | 
|---|
| 46 | #define LM_ISINF(x) isinf(x) // other than MSVC, ICC, GCC, let's hope this will work | 
|---|
| 47 | #endif | 
|---|
| 48 |  | 
|---|
| 49 | #endif /* _COMPILER_H_ */ | 
|---|