--- /dev/null
+/*
+ * mlp-mnist is an implementation of a multi-layer neural network.
+ *
+ * Copyright (c) 2008 Idiap Research Institute, http://www.idiap.ch/
+ * Written by Francois Fleuret <francois.fleuret@idiap.ch>
+ *
+ * This file is part of mlp-mnist.
+ *
+ * mlp-mnist is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * mlp-mnist is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with mlp-mnist. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// $Id: misc.cc,v 1.1 2005-12-13 17:19:11 fleuret Exp $
+
+#include "misc.h"
+
+int compare_couple(const void *a, const void *b) {
+ if(((Couple *) a)->value < ((Couple *) b)->value) return -1;
+ else if(((Couple *) a)->value > ((Couple *) b)->value) return 1;
+ else return 0;
+}
+
+int factorial(int k) {
+ int n = 1;
+ for(int l = 1; l <= k; l++) n *= l;
+ return n;
+}