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