[5443b1] | 1 | /////////////////////////////////////////////////////////////////////////////////
|
---|
| 2 | //
|
---|
| 3 | // Solution of linear systems involved in the Levenberg - Marquardt
|
---|
| 4 | // minimization algorithm
|
---|
| 5 | // Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
|
---|
| 6 | // Institute of Computer Science, Foundation for Research & Technology - Hellas
|
---|
| 7 | // Heraklion, Crete, Greece.
|
---|
| 8 | //
|
---|
| 9 | // This program is free software; you can redistribute it and/or modify
|
---|
| 10 | // it under the terms of the GNU General Public License as published by
|
---|
| 11 | // the Free Software Foundation; either version 2 of the License, or
|
---|
| 12 | // (at your option) any later version.
|
---|
| 13 | //
|
---|
| 14 | // This program is distributed in the hope that it will be useful,
|
---|
| 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 17 | // GNU General Public License for more details.
|
---|
| 18 | //
|
---|
| 19 | /////////////////////////////////////////////////////////////////////////////////
|
---|
| 20 |
|
---|
| 21 | /********************************************************************************
|
---|
| 22 | * LAPACK-based implementations for various linear system solvers. The same core
|
---|
| 23 | * code is used with appropriate #defines to derive single and double precision
|
---|
| 24 | * solver versions, see also Axb_core.c
|
---|
| 25 | ********************************************************************************/
|
---|
| 26 |
|
---|
| 27 | #include <stdio.h>
|
---|
| 28 | #include <stdlib.h>
|
---|
| 29 | #include <string.h>
|
---|
| 30 | #include <math.h>
|
---|
| 31 |
|
---|
| 32 | #include "levmar.h"
|
---|
| 33 | #include "misc.h"
|
---|
| 34 |
|
---|
| 35 | #if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
|
---|
| 36 | #error At least one of LM_DBL_PREC, LM_SNGL_PREC should be defined!
|
---|
| 37 | #endif
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | #ifdef LM_DBL_PREC
|
---|
| 41 | /* double precision definitions */
|
---|
| 42 | #define LM_REAL double
|
---|
| 43 | #define LM_PREFIX d
|
---|
| 44 | #define LM_CNST(x) (x)
|
---|
| 45 | #ifndef HAVE_LAPACK
|
---|
| 46 | #include <float.h>
|
---|
| 47 | #define LM_REAL_EPSILON DBL_EPSILON
|
---|
| 48 | #endif
|
---|
| 49 |
|
---|
| 50 | #include "Axb_core.c"
|
---|
| 51 |
|
---|
| 52 | #undef LM_REAL
|
---|
| 53 | #undef LM_PREFIX
|
---|
| 54 | #undef LM_CNST
|
---|
| 55 | #undef LM_REAL_EPSILON
|
---|
| 56 | #endif /* LM_DBL_PREC */
|
---|
| 57 |
|
---|
| 58 | #ifdef LM_SNGL_PREC
|
---|
| 59 | /* single precision (float) definitions */
|
---|
| 60 | #define LM_REAL float
|
---|
| 61 | #define LM_PREFIX s
|
---|
| 62 | #define __SUBCNST(x) x##F
|
---|
| 63 | #define LM_CNST(x) __SUBCNST(x) // force substitution
|
---|
| 64 | #ifndef HAVE_LAPACK
|
---|
| 65 | #define LM_REAL_EPSILON FLT_EPSILON
|
---|
| 66 | #endif
|
---|
| 67 |
|
---|
| 68 | #include "Axb_core.c"
|
---|
| 69 |
|
---|
| 70 | #undef LM_REAL
|
---|
| 71 | #undef LM_PREFIX
|
---|
| 72 | #undef __SUBCNST
|
---|
| 73 | #undef LM_CNST
|
---|
| 74 | #undef LM_REAL_EPSILON
|
---|
| 75 | #endif /* LM_SNGL_PREC */
|
---|