X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=misc.h;h=4762eaa19c44ba98c49e9e988ebf226242f3ad4b;hb=d34ac2b649f3f88ffae5d52f36e1d86b75791d39;hp=d5f956cb75bc62506aeafd8aae9acdf74a269b30;hpb=194e1b60502426108c6f6c3cf2e08e95e7a2811d;p=svrt.git
diff --git a/misc.h b/misc.h
index d5f956c..4762eaa 100644
--- a/misc.h
+++ b/misc.h
@@ -18,7 +18,7 @@
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with selector. If not, see .
+ * along with svrt. If not, see .
*
*/
@@ -67,18 +67,21 @@ void deallocate_array(T **array) {
delete[] array;
}
-template
-T smooth_min(T x, T y) {
- T z = exp(x - y);
- return 0.5 * (x + y - (x - y)/(1 + 1/z) - (y - x)/(1 + z));
-}
-
template
void write_var(ostream *os, const T *x) { os->write((char *) x, sizeof(T)); }
template
void read_var(istream *is, T *x) { is->read((char *) x, sizeof(T)); }
+template
+inline T sq(T x) {
+ return x * x;
+}
+
+inline scalar_t log2(scalar_t x) {
+ return log(x)/log(2.0);
+}
+
template
void grow(int *nb_max, int nb, T** current, int factor) {
ASSERT(*nb_max > 0);
@@ -91,34 +94,4 @@ void grow(int *nb_max, int nb, T** current, int factor) {
}
}
-template
-inline T sq(T x) {
- return x * x;
-}
-
-inline scalar_t log2(scalar_t x) {
- return log(x)/log(2.0);
-}
-
-inline scalar_t xi(scalar_t x) {
- if(x <= 0.0) return 0.0;
- else return - x * log(x)/log(2.0);
-}
-
-scalar_t discrete_entropy(int *n, int nb);
-
-char *basename(char *name);
-
-char *next_word(char *buffer, char *r, int buffer_size);
-
-void random_permutation(int *val, int nb);
-void tag_subset(bool *val, int nb_total, int nb_to_tag);
-
-struct Couple {
- int index;
- scalar_t value;
-};
-
-int compare_couple(const void *a, const void *b);
-
#endif