Adding klu_internal and klu_version.
[JKLU.git] / src / main / java / edu / ufl / cise / klu / tdouble / Dklu_internal.java
blob7b3b90786d6e5536a8ac5e47da0c2fcf21702c9d
1 /**
2 * KLU: a sparse LU factorization algorithm.
3 * Copyright (C) 2004-2009, Timothy A. Davis.
4 * Copyright (C) 2011, Richard W. Lincoln.
5 * http://www.cise.ufl.edu/research/sparse/klu
7 * -------------------------------------------------------------------------
9 * KLU is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * KLU is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this Module; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 package edu.ufl.cise.klu.tdouble;
27 public abstract class Dklu_internal extends Dklu_version {
29 /**
30 * enable debugging and assertions
32 static boolean NDEBUG = true;
34 static void ASSERT (boolean a)
36 if (!NDEBUG)
38 assert a;
42 /**
43 * @return true if an integer (stored in double x) would overflow (or if
44 * x is NaN)
46 static boolean INT_OVERFLOW (double x)
48 return ((!(x * (1.0+1e-8) <= (double) INT_MAX))
49 || SCALAR_IS_NAN (x));
52 static final int TRUE = 1;
53 static final int FALSE = 0;
55 static double MAX (double a, double b)
57 return a > b ? a : b;
60 static double MIN (double a, double b)
62 return a < b ? a : b;
65 /* FLIP is a "negation about -1", and is used to mark an integer i that is
66 * normally non-negative. FLIP (EMPTY) is EMPTY. FLIP of a number > EMPTY
67 * is negative, and FLIP of a number < EMTPY is positive. FLIP (FLIP (i)) = i
68 * for all integers i. UNFLIP (i) is >= EMPTY. */
69 static final int EMPTY = -1;
71 static double FLIP (double i)
73 return -i - 2;
76 static double UNFLIP (double i)
78 return (i < EMPTY) ? FLIP (i) : i;