Browse Source

Correct docs.

shkolnick-kun 3 months ago
parent
commit
da2980a810
4 changed files with 70 additions and 83 deletions
  1. 32 39
      README.md
  2. 32 39
      doc/C-Manual.md
  3. 0 5
      src/yaflpy/yafl_config.h
  4. 6 0
      tests/projects/yafl_hdf_tests.workspace

+ 32 - 39
README.md

@@ -69,45 +69,38 @@ To use the library you need to:
 
 #include <math.h>
 #include <stdint.h>
-
-#ifdef DEBUG
-    /*
-    In this example we will use standard output.
-    You can actually use any printf implementation you want.
-    */
-#   include <stdio.h>
-#   define YAFL_LOG(...) fprintf(stderr, __VA_ARGS__)
-
-    /*
-    Using branch speculation may save some clocks...
-    */
-#   ifdef __GNUC__
-#       define YAFL_UNLIKELY(x) __builtin_expect((x), 0)
-#   else /*__GNUC__*/
-#       define YAFL_UNLIKELY(x) (x)
-#   endif/*__GNUC__*/
-
-#else /*DEBUG*/
-
-    /*
-    Here we have "Never" actually, but you can use some of above definitions if you want.
-    */
-#   define YAFL_UNLIKELY(x) (0)
-
-#endif/*DEBUG*/
-
-#define YAFL_EPS  (1.0e-7)
-
-#define YAFL_SQRT sqrtf
-#define YAFL_ABS  fabs
-
-typedef float   yaflFloat;
-typedef int32_t   yaflInt;
-
-/* WARNING!!!
-Fast UKF SSR updates may give dramatically incorrect results in case of adaptive Bierman filter
-*/
-//#define YAFL_USE_FAST_UKF
+#include <stdio.h>
+
+#define YAFL_DBG(...) fprintf(stderr, __VA_ARGS__)
+
+typedef int32_t yaflInt;
+
+#ifndef YAFL_USE_64_BIT
+#   define YAFL_USE_64_BIT (0)
+#endif/*YAFL_USE_64_BIT*/
+
+#if YAFL_USE_64_BIT
+    typedef double  yaflFloat;
+#   define YAFL_EPS  (1.0e-15)
+#   define YAFL_SQRT sqrt
+#   define YAFL_ABS  fabs
+#   define YAFL_ABS  fabs
+#   define YAFL_EXP  exp
+#   define YAFL_LOG  log
+#else/*YAFL_USE_64_BIT*/
+    typedef float  yaflFloat;
+#   define YAFL_EPS  (1.0e-6)
+#   define YAFL_SQRT sqrtf
+#   define YAFL_ABS  fabsf
+#   define YAFL_EXP  expf
+#   define YAFL_LOG  logf
+#endif/*YAFL_USE_64_BIT*/
+
+#ifdef __GNUC__
+#   define YAFL_UNLIKELY(x) __builtin_expect((x), 0)
+#else
+#   define YAFL_UNLIKELY(x) (x)
+#endif
 
 #endif // YAFL_CONFIG_H
 

+ 32 - 39
doc/C-Manual.md

@@ -18,45 +18,38 @@ Well, they are:
 
 #include <math.h>
 #include <stdint.h>
-
-#ifdef DEBUG
-    /*
-    In this example we will use standard output.
-    You can actually use any printf implementation you want.
-    */
-#   include <stdio.h>
-#   define YAFL_LOG(...) fprintf(stderr, __VA_ARGS__)
-
-    /*
-    Using branch speculation may save some clocks...
-    */
-#   ifdef __GNUC__
-#       define YAFL_UNLIKELY(x) __builtin_expect((x), 0)
-#   else /*__GNUC__*/
-#       define YAFL_UNLIKELY(x) (x)
-#   endif/*__GNUC__*/
-
-#else /*DEBUG*/
-
-    /*
-    Here we have "Never" actually, but you can use some of above definitions if you want.
-    */
-#   define YAFL_UNLIKELY(x) (0)
-
-#endif/*DEBUG*/
-
-#define YAFL_EPS  (1.0e-7)
-
-#define YAFL_SQRT sqrtf
-#define YAFL_ABS  fabs
-
-typedef float   yaflFloat;
-typedef int32_t   yaflInt;
-
-/* WARNING!!!
-Fast UKF SSR updates may give dramatically incorrect results in case of adaptive Bierman filter
-*/
-//#define YAFL_USE_FAST_UKF
+#include <stdio.h>
+
+#define YAFL_DBG(...) fprintf(stderr, __VA_ARGS__)
+
+typedef int32_t yaflInt;
+
+#ifndef YAFL_USE_64_BIT
+#   define YAFL_USE_64_BIT (0)
+#endif/*YAFL_USE_64_BIT*/
+
+#if YAFL_USE_64_BIT
+    typedef double  yaflFloat;
+#   define YAFL_EPS  (1.0e-15)
+#   define YAFL_SQRT sqrt
+#   define YAFL_ABS  fabs
+#   define YAFL_ABS  fabs
+#   define YAFL_EXP  exp
+#   define YAFL_LOG  log
+#else/*YAFL_USE_64_BIT*/
+    typedef float  yaflFloat;
+#   define YAFL_EPS  (1.0e-6)
+#   define YAFL_SQRT sqrtf
+#   define YAFL_ABS  fabsf
+#   define YAFL_EXP  expf
+#   define YAFL_LOG  logf
+#endif/*YAFL_USE_64_BIT*/
+
+#ifdef __GNUC__
+#   define YAFL_UNLIKELY(x) __builtin_expect((x), 0)
+#else
+#   define YAFL_UNLIKELY(x) (x)
+#endif
 
 #endif // YAFL_CONFIG_H
 

+ 0 - 5
src/yaflpy/yafl_config.h

@@ -53,9 +53,4 @@ typedef int32_t yaflInt;
 #   define YAFL_UNLIKELY(x) (x)
 #endif
 
-/* WARNING!!!
-Fast UKF SSR updates may give dramatically incorrect results in case of adaptive Bierman filter
-*/
-//#define YAFL_USE_FAST_UKF
-
 #endif // YAFL_CONFIG_H

+ 6 - 0
tests/projects/yafl_hdf_tests.workspace

@@ -9,5 +9,11 @@
 		<Project filename="ada_rob_joseph/hdf5_test.cbp" />
 		<Project filename="rob_bierman/hdf5_test.cbp" />
 		<Project filename="rob_joseph/hdf5_test.cbp" />
+		<Project filename="ada_ukf/hdf5_test.cbp" />
+		<Project filename="ada_ukf_bierman/hdf5_test.cbp" />
+		<Project filename="ada_rob_ukf_bierman/hdf5_test.cbp" />
+		<Project filename="rob_ukf_bierman/hdf5_test.cbp" />
+		<Project filename="ukf/hdf5_test.cbp" />
+		<Project filename="ukf_bierman/hdf5_test.cbp" />
 	</Workspace>
 </CodeBlocks_workspace_file>