summaryrefslogtreecommitdiff
path: root/flower
diff options
context:
space:
mode:
Diffstat (limited to 'flower')
-rw-r--r--flower/.version2
-rw-r--r--flower/NEWS3
-rw-r--r--flower/TODO6
-rw-r--r--flower/choleski.cc18
-rw-r--r--flower/full-storage.cc2
-rw-r--r--flower/include/virtual-methods.hh16
-rw-r--r--flower/string-convert.cc2
7 files changed, 35 insertions, 14 deletions
diff --git a/flower/.version b/flower/.version
index a6d093ed41..6214501523 100644
--- a/flower/.version
+++ b/flower/.version
@@ -1,6 +1,6 @@
MAJOR_VERSION = 1
MINOR_VERSION = 1
-PATCH_LEVEL = 22
+PATCH_LEVEL = 23
# use to send patches, always empty for released version:
MY_PATCH_LEVEL = # include separator: "-1" or ".a"
#
diff --git a/flower/NEWS b/flower/NEWS
index e7aaaa390e..3b0cf5e684 100644
--- a/flower/NEWS
+++ b/flower/NEWS
@@ -1,5 +1,8 @@
version 1.1:
+pl 23:
+ - virtual-methods : static_is_type_b
+ - Choleski checks no if PARANOID
pl 22:
- ACursor and PACursor to give array a List like interface.
diff --git a/flower/TODO b/flower/TODO
index b810fabd7a..169a0525e6 100644
--- a/flower/TODO
+++ b/flower/TODO
@@ -1,3 +1,7 @@
+ * write a String_hash template
+
+ * write a Pointer_hash template
+
* fix/junk ambiguous String constructor overloads, e.g.:
String( int ) and String( char )
@@ -7,7 +11,7 @@
* disable this auto conv: const pointer -> bool -> string
- * PointerVec ?
+ * Pointer_array
* PCursor -> Pointer_cursor / PointerCursor ?
diff --git a/flower/choleski.cc b/flower/choleski.cc
index d10372fdfd..202e184440 100644
--- a/flower/choleski.cc
+++ b/flower/choleski.cc
@@ -1,3 +1,11 @@
+/*
+ choleski.cc -- implement Choleski_decomposition
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "choleski.hh"
const Real EPS = 1e-7; // so sue me. Hard coded
@@ -31,14 +39,18 @@ Choleski_decomposition::solve(Vector rhs)const
/*
Standard matrix algorithm.
+ Should add support for banded matrices
*/
Choleski_decomposition::Choleski_decomposition(Matrix P)
: L(P.dim()), D(P.dim())
{
int n = P.dim();
- assert((P-P.transposed()).norm()/P.norm() < EPS);
+#ifdef PARANOID
+ assert((P-P.transposed()).norm()/P.norm() < EPS);
+#endif
+
L.unit();
for (int k= 0; k < n; k++) {
for (int j = 0; j < k; j++){
@@ -55,7 +67,7 @@ Choleski_decomposition::Choleski_decomposition(Matrix P)
D(k) = d;
}
-#ifndef NDEBUG
+#ifdef PARANOID
assert((original()-P).norm() / P.norm() < EPS);
#endif
}
@@ -81,7 +93,7 @@ Choleski_decomposition::inverse() const
invm(i,j) = inv(j);
}
-#ifndef NDEBUG
+#ifdef PARANOID
Matrix I1(n), I2(original());
I1.unit();
assert((I1-I2*invm).norm()/I2.norm() < EPS);
diff --git a/flower/full-storage.cc b/flower/full-storage.cc
index 0a7bf4efbe..1b5c05a392 100644
--- a/flower/full-storage.cc
+++ b/flower/full-storage.cc
@@ -211,7 +211,5 @@ Full_storage::try_right_multiply(Matrix_storage * dest, Matrix_storage const * r
}
-IMPLEMENT_STATIC_NAME(Full_storage);
-IMPLEMENT_STATIC_NAME(Matrix_storage);
IMPLEMENT_IS_TYPE_B(Matrix_storage);
IMPLEMENT_IS_TYPE_B1(Full_storage,Matrix_storage);
diff --git a/flower/include/virtual-methods.hh b/flower/include/virtual-methods.hh
index ea81cbbc99..b8933baa0e 100644
--- a/flower/include/virtual-methods.hh
+++ b/flower/include/virtual-methods.hh
@@ -16,7 +16,8 @@
*/
#define NAME_MEMBERS() \
static char const *static_name();\
-virtual bool is_type_b(const char *)const; \
+static bool static_is_type_b(const char*s);\
+virtual bool is_type_b(const char *s)const { return static_is_type_b(s); } \
virtual char const *name() const{ return static_name(); } \
int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out()
@@ -28,20 +29,23 @@ int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out()
int yet_another_stupid_function_to_allow_semicolon()
#define IMPLEMENT_IS_TYPE_B(D) \
- bool D::is_type_b(const char *s) const \
+ IMPLEMENT_STATIC_NAME(D)\
+ bool D::static_is_type_b(const char *s) \
{ \
return s == static_name(); \
}
#define IMPLEMENT_IS_TYPE_B1(D,B) \
- bool D::is_type_b(const char *s)const \
+ IMPLEMENT_STATIC_NAME(D)\
+ bool D::static_is_type_b(const char *s) \
{ \
- return s == static_name() || B::is_type_b(s); \
+ return s == static_name() || B::static_is_type_b(s); \
}
#define IMPLEMENT_IS_TYPE_B2(D, BA, BB) \
- bool D::is_type_b(const char *s) const \
+ IMPLEMENT_STATIC_NAME(D)\
+ bool D::static_is_type_b(const char *s) \
{ \
- return s == static_name() || BA::is_type_b(s) || BB::is_type_b(s); \
+ return s == static_name() || BA::static_is_type_b(s) || BB::static_is_type_b(s); \
}
#endif
diff --git a/flower/string-convert.cc b/flower/string-convert.cc
index feb793369f..f791e1f6c2 100644
--- a/flower/string-convert.cc
+++ b/flower/string-convert.cc
@@ -204,7 +204,7 @@ String_convert::int_str(int i, char const* fmt)
String
String_convert::double_str(double f, char const* fmt)
{
- char buf[STRING_BUFFER_LEN];
+ static char buf[STRING_BUFFER_LEN];
snprintf(buf, STRING_BUFFER_LEN, fmt ? fmt : "%f", f);
return buf;