From e253f3a6bba4adfc518fa5ce6081c7cef5d87a97 Mon Sep 17 00:00:00 2001 From: Richard Lincoln Date: Sun, 31 Jul 2011 12:36:57 +0100 Subject: [PATCH] Adding common package. --- .../java/edu/ufl/cise/klu/common/KLU_analyze.java | 50 +++++++++ .../edu/ufl/cise/klu/common/KLU_analyze_given.java | 52 ++++++++++ .../java/edu/ufl/cise/klu/common/KLU_common.java | 114 +++++++++++++++++++++ .../java/edu/ufl/cise/klu/common/KLU_defaults.java | 35 +++++++ .../java/edu/ufl/cise/klu/common/KLU_factor.java | 48 +++++++++ .../edu/ufl/cise/klu/common/KLU_l_analyze.java | 52 ++++++++++ .../ufl/cise/klu/common/KLU_l_analyze_given.java | 54 ++++++++++ .../java/edu/ufl/cise/klu/common/KLU_l_common.java | 50 +++++++++ .../edu/ufl/cise/klu/common/KLU_l_defaults.java | 37 +++++++ .../java/edu/ufl/cise/klu/common/KLU_l_factor.java | 50 +++++++++ .../edu/ufl/cise/klu/common/KLU_l_numeric.java | 71 +++++++++++++ .../edu/ufl/cise/klu/common/KLU_l_symbolic.java | 65 ++++++++++++ .../java/edu/ufl/cise/klu/common/KLU_numeric.java | 69 +++++++++++++ .../java/edu/ufl/cise/klu/common/KLU_symbolic.java | 64 ++++++++++++ .../java/edu/ufl/cise/klu/common/KLU_version.java | 47 +++++++++ .../java/edu/ufl/cise/klu/common/KLU_z_factor.java | 50 +++++++++ .../edu/ufl/cise/klu/common/KLU_zl_factor.java | 50 +++++++++ .../edu/ufl/cise/klu/tdouble/Dklu_version.java | 38 +++++++ 18 files changed, 996 insertions(+) create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_analyze.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_analyze_given.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_common.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_defaults.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_factor.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_l_analyze.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_l_analyze_given.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_l_common.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_l_defaults.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_l_factor.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_l_numeric.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_l_symbolic.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_numeric.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_symbolic.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_version.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_z_factor.java create mode 100644 src/main/java/edu/ufl/cise/klu/common/KLU_zl_factor.java create mode 100644 src/main/java/edu/ufl/cise/klu/tdouble/Dklu_version.java diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_analyze.java b/src/main/java/edu/ufl/cise/klu/common/KLU_analyze.java new file mode 100644 index 0000000..72b0509 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_analyze.java @@ -0,0 +1,50 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Orders and analyzes a matrix. + */ +public class KLU_analyze +{ + + /* Order the matrix with BTF (or not), then order each block with AMD, + * COLAMD, a natural ordering, or with a user-provided ordering function */ + + /** + * + * @param n A is n-by-n + * @param Ap size n+1, column pointers + * @param Ai size nz, row indices + * @param Common + * @return + */ + public static KLU_symbolic klu_analyze(int n, int[] Ap, int[] Ai, + KLU_common Common) + { + return null; + } + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_analyze_given.java b/src/main/java/edu/ufl/cise/klu/common/KLU_analyze_given.java new file mode 100644 index 0000000..da75e63 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_analyze_given.java @@ -0,0 +1,52 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Analyzes a matrix using given P and Q. + */ +public class KLU_analyze_given +{ + + /* Order the matrix with BTF (or not), then use natural or given ordering + * P and Q on the blocks. P and Q are interpretted as identity + * if NULL. */ + + /** + * + * @param n A is n-by-n + * @param Ap size n+1, column pointers + * @param Ai size nz, row indices + * @param P size n, user's row permutation (may be NULL) + * @param Q size n, user's column permutation (may be NULL) + * @param Common + */ + public static KLU_symbolic klu_analyze_given(int n, int[] Ap, int[] Ai, + int[] P, int[] Q, KLU_common Common) + { + return null; + } + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_common.java b/src/main/java/edu/ufl/cise/klu/common/KLU_common.java new file mode 100644 index 0000000..d908600 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_common.java @@ -0,0 +1,114 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * KLU control parameters and statistics. + */ +public class KLU_common +{ + + static final int KLU_OK = 0; + /* status > 0 is a warning, not an error */ + static final int KLU_SINGULAR = 1; + static final int KLU_OUT_OF_MEMORY = -2; + static final int KLU_INVALID = -3; + /* integer overflow has occured */ + static final int KLU_TOO_LARGE = -4; + + /* ---------------------------------------------------------------------- */ + /* parameters */ + /* ---------------------------------------------------------------------- */ + + double tol; /* pivot tolerance for diagonal preference */ + double memgrow; /* realloc memory growth size for LU factors */ + double initmem_amd; /* init. memory size with AMD: c*nnz(L) + n */ + double initmem; /* init. memory size: c*nnz(A) + n */ + double maxwork; /* maxwork for BTF, <= 0 if no limit */ + + int btf; /* use BTF pre-ordering, or not */ + int ordering; /* 0: AMD, 1: COLAMD, 2: user P and Q, + * 3: user function */ + int scale; /* row scaling: -1: none (and no error check), + * 0: none, 1: sum, 2: max */ + + /* memory management routines */ +// void *(*malloc_memory) (size_t); /* pointer to malloc */ +// void *(*realloc_memory) (void *, size_t); /* pointer to realloc */ +// void (*free_memory) (void *); /* pointer to free */ +// void *(*calloc_memory) (size_t, size_t); /* pointer to calloc */ + + /* pointer to user ordering function */ +// int (*user_order) (int, int *, int *, int *, struct klu_common_struct *); + + /* pointer to user data, passed unchanged as the last parameter to the + * user ordering function (optional, the user function need not use this + * information). */ + Object user_data; + + int halt_if_singular; /* how to handle a singular matrix: + * FALSE: keep going. Return a Numeric object with a zero U(k,k). A + * divide-by-zero may occur when computing L(:,k). The Numeric object + * can be passed to klu_solve (a divide-by-zero will occur). It can + * also be safely passed to klu_refactor. + * TRUE: stop quickly. klu_factor will free the partially-constructed + * Numeric object. klu_refactor will not free it, but will leave the + * numerical values only partially defined. This is the default. */ + + /* ---------------------------------------------------------------------- */ + /* statistics */ + /* ---------------------------------------------------------------------- */ + + int status; /* KLU_OK if OK, < 0 if error */ + int nrealloc; /* # of reallocations of L and U */ + + int structural_rank; /* 0 to n-1 if the matrix is structurally rank + * deficient (as determined by maxtrans). -1 if not computed. n if the + * matrix has full structural rank. This is computed by klu_analyze + * if a BTF preordering is requested. */ + + int numerical_rank; /* First k for which a zero U(k,k) was found, + * if the matrix was singular (in the range 0 to n-1). n if the matrix + * has full rank. This is not a true rank-estimation. It just reports + * where the first zero pivot was found. -1 if not computed. + * Computed by klu_factor and klu_refactor. */ + + int singular_col; /* n if the matrix is not singular. If in the + * range 0 to n-1, this is the column index of the original matrix A that + * corresponds to the column of U that contains a zero diagonal entry. + * -1 if not computed. Computed by klu_factor and klu_refactor. */ + + int noffdiag; /* # of off-diagonal pivots, -1 if not computed */ + + double flops; /* actual factorization flop count, from klu_flops */ + double rcond; /* crude reciprocal condition est., from klu_rcond */ + double condest; /* accurate condition est., from klu_condest */ + double rgrowth; /* reciprocal pivot rgrowth, from klu_rgrowth */ + double work; /* actual work done in BTF, in klu_analyze */ + + size_t memusage; /* current memory usage, in bytes */ + size_t mempeak; /* peak memory usage, in bytes */ + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_defaults.java b/src/main/java/edu/ufl/cise/klu/common/KLU_defaults.java new file mode 100644 index 0000000..56dc980 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_defaults.java @@ -0,0 +1,35 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Sets default control parameters. + */ +public class KLU_defaults +{ + + KLU_common Common; + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_factor.java b/src/main/java/edu/ufl/cise/klu/common/KLU_factor.java new file mode 100644 index 0000000..ec28b69 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_factor.java @@ -0,0 +1,48 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Factors a matrix using the klu_analyze results. + */ +public class KLU_factor +{ + + /** + * + * @param Ap size n+1, column pointers + * @param Ai size nz, row indices + * @param Ax size nz, numerical values + * @param Symbolic + * @param Common + * @return KLU_OK if OK, < 0 if error + */ + public static KLU_numeric klu_factor(int[] Ap, int[] Ai, double[] Ax, + KLU_symbolic Symbolic, KLU_common Common) + { + return null; + } + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_l_analyze.java b/src/main/java/edu/ufl/cise/klu/common/KLU_l_analyze.java new file mode 100644 index 0000000..cc1f26a --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_l_analyze.java @@ -0,0 +1,52 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Orders and analyzes a matrix. + * + * 64-bit version. + */ +public class KLU_l_analyze +{ + + /* Order the matrix with BTF (or not), then order each block with AMD, + * COLAMD, a natural ordering, or with a user-provided ordering function */ + + /** + * + * @param n A is n-by-n + * @param Ap size n+1, column pointers + * @param Ai size nz, row indices + * @param Common + * @return + */ + public static KLU_l_symbolic klu_l_analyze(long n, long[] Ap, long[] Ai, + KLU_l_common Common) + { + return null; + } + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_l_analyze_given.java b/src/main/java/edu/ufl/cise/klu/common/KLU_l_analyze_given.java new file mode 100644 index 0000000..a1f38e0 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_l_analyze_given.java @@ -0,0 +1,54 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Analyzes a matrix using given P and Q. + * + * 64-bit version. + */ +public class KLU_l_analyze_given +{ + + /* Order the matrix with BTF (or not), then use natural or given ordering + * P and Q on the blocks. P and Q are interpretted as identity + * if NULL. */ + + /** + * + * @param n A is n-by-n + * @param Ap size n+1, column pointers + * @param Ai size nz, row indices + * @param P size n, user's row permutation (may be NULL) + * @param Q size n, user's column permutation (may be NULL) + * @param Common + */ + public static KLU_l_symbolic klu_l_analyze_given(long n, long[] Ap, + long[] Ai, long[] P, long[] Q, KLU_l_common Common) + { + return null; + } + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_l_common.java b/src/main/java/edu/ufl/cise/klu/common/KLU_l_common.java new file mode 100644 index 0000000..b532d38 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_l_common.java @@ -0,0 +1,50 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * KLU control parameters and statistics. + * + * 64-bit version. + */ +public class KLU_l_common +{ + + double tol, memgrow, initmem_amd, initmem, maxwork; + long btf, ordering, scale; +// void *(*malloc_memory) (size_t); +// void *(*realloc_memory) (void *, size_t); +// void (*free_memory) (void *); +// void *(*calloc_memory) (size_t, size_t); +// UF_long (*user_order) (UF_long, UF_long *, UF_long *, UF_long *, +// struct klu_l_common_struct *); + Object user_data; + long halt_if_singular; + long status, nrealloc, structural_rank, numerical_rank, singular_col, + noffdiag; + double flops, rcond, condest, rgrowth, work; + size_t memusage, mempeak; + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_l_defaults.java b/src/main/java/edu/ufl/cise/klu/common/KLU_l_defaults.java new file mode 100644 index 0000000..36e6904 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_l_defaults.java @@ -0,0 +1,37 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Sets default control parameters. + * + * 64-bit version. + */ +public class KLU_l_defaults +{ + + KLU_l_common Common; + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_l_factor.java b/src/main/java/edu/ufl/cise/klu/common/KLU_l_factor.java new file mode 100644 index 0000000..4402da4 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_l_factor.java @@ -0,0 +1,50 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Factors a matrix using the klu_analyze results. + * + * Long / real version. + */ +public class KLU_l_factor +{ + + /** + * + * @param Ap size n+1, column pointers + * @param Ai size nz, row indices + * @param Ax size nz, numerical values + * @param Symbolic + * @param Common + * @return KLU_OK if OK, < 0 if error + */ + public static KLU_l_numeric klu_l_factor(long[] Ap, long[] Ai, double[] Ax, + KLU_l_symbolic Symbolic, KLU_l_common Common) + { + return null; + } + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_l_numeric.java b/src/main/java/edu/ufl/cise/klu/common/KLU_l_numeric.java new file mode 100644 index 0000000..9a9fa30 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_l_numeric.java @@ -0,0 +1,71 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Numeric object - contains the factors computed by klu_factor. + * + * 64-bit version. + */ +public class KLU_l_numeric +{ + + /* LU factors of each block, the pivot row permutation, and the + * entries in the off-diagonal blocks */ + + long n; /* A is n-by-n */ + long nblocks; /* number of diagonal blocks */ + long lnz; /* actual nz in L, including diagonal */ + long unz; /* actual nz in U, including diagonal */ + long max_lnz_block; /* max actual nz in L in any one block, incl. diag */ + long max_unz_block; /* max actual nz in U in any one block, incl. diag */ + long[] Pnum; /* size n. final pivot permutation */ + long[] Pinv; /* size n. inverse of final pivot permutation */ + + /* LU factors of each block */ + long[] Lip; /* size n. pointers into LUbx[block] for L */ + long[] Uip; /* size n. pointgers into LUbx[block] for U */ + int[] Llen; /* size n. Llen [k] = # of entries in kth column of L */ + long[] Ulen; /* size n. Ulen [k] = # of entries in kth column of U */ + void[][] LUbx; /* L and U indices and entries (excl. diagonal of U) */ + size_t[] LUsize; /* size of each LUbx [block], in sizeof (Unit) */ + void[] Udiag; /* diagonal of U */ + + /* scale factors; can be NULL if no scaling */ + double[] Rs; /* size n. Rs [i] is scale factor for row i */ + + /* permanent workspace for factorization and solve */ + size_t[] worksize; /* size (in bytes) of Work */ + void[] Work; /* workspace */ + void[] Xwork; /* alias into Numeric->Work */ + long[] Iwork; /* alias into Numeric->Work */ + + /* off-diagonal entries in a conventional compressed-column sparse matrix */ + long[] Offp; /* size n+1, column pointers */ + long[] Offi; /* size nzoff, row indices */ + void[] Offx; /* size nzoff, numerical values */ + long nzoff; + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_l_symbolic.java b/src/main/java/edu/ufl/cise/klu/common/KLU_l_symbolic.java new file mode 100644 index 0000000..2d8660c --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_l_symbolic.java @@ -0,0 +1,65 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Symbolic object - contains the pre-ordering computed by klu_analyze. + * + * 64-bit version. + */ +public class KLU_l_symbolic +{ + /* A (P,Q) is in upper block triangular form. The kth block goes from + * row/col index R [k] to R [k+1]-1. The estimated number of nonzeros + * in the L factor of the kth block is Lnz [k]. + */ + + /* only computed if the AMD ordering is chosen: */ + double symmetry; /* symmetry of largest block */ + double est_flops; /* est. factorization flop count */ + double lnz, unz; /* estimated nz in L and U, including diagonals */ + double[] Lnz; /* size n, but only Lnz [0..nblocks-1] is used */ + + /* computed for all orderings: */ + long + n, /* input matrix A is n-by-n */ + nz, /* # entries in input matrix */ + nzoff, /* nz in off-diagonal blocks */ + nblocks, /* number of blocks */ + maxblock, /* size of largest block */ + ordering, /* ordering used (AMD, COLAMD, or GIVEN) */ + do_btf; /* whether or not BTF preordering was requested */ + + long[] + P, /* size n */ + Q, /* size n */ + R; /* size n+1, but only R [0..nblocks] is used */ + + /* only computed if BTF preordering requested */ + int structural_rank; /* 0 to n-1 if the matrix is structurally rank + * deficient. -1 if not computed. n if the matrix has + * full structural rank */ + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_numeric.java b/src/main/java/edu/ufl/cise/klu/common/KLU_numeric.java new file mode 100644 index 0000000..24076b6 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_numeric.java @@ -0,0 +1,69 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Numeric object - contains the factors computed by klu_factor. + */ +public class KLU_numeric +{ + + /* LU factors of each block, the pivot row permutation, and the + * entries in the off-diagonal blocks */ + + int n; /* A is n-by-n */ + int nblocks; /* number of diagonal blocks */ + int lnz; /* actual nz in L, including diagonal */ + int unz; /* actual nz in U, including diagonal */ + int max_lnz_block; /* max actual nz in L in any one block, incl. diag */ + int max_unz_block; /* max actual nz in U in any one block, incl. diag */ + int[] Pnum; /* size n. final pivot permutation */ + int[] Pinv; /* size n. inverse of final pivot permutation */ + + /* LU factors of each block */ + int[] Lip; /* size n. pointers into LUbx[block] for L */ + int[] Uip; /* size n. pointers into LUbx[block] for U */ + int[] Llen; /* size n. Llen [k] = # of entries in kth column of L */ + int[] Ulen; /* size n. Ulen [k] = # of entries in kth column of U */ + void[][] LUbx; /* L and U indices and entries (excl. diagonal of U) */ + size_t[] LUsize; /* size of each LUbx [block], in sizeof (Unit) */ + void[] Udiag; /* diagonal of U */ + + /* scale factors; can be NULL if no scaling */ + double[] Rs; /* size n. Rs [i] is scale factor for row i */ + + /* permanent workspace for factorization and solve */ + size_t[] worksize; /* size (in bytes) of Work */ + void[] Work; /* workspace */ + void[] Xwork; /* alias into Numeric->Work */ + int[] Iwork; /* alias into Numeric->Work */ + + /* off-diagonal entries in a conventional compressed-column sparse matrix */ + int[] Offp; /* size n+1, column pointers */ + int[] Offi; /* size nzoff, row indices */ + void[] Offx; /* size nzoff, numerical values */ + int nzoff; + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_symbolic.java b/src/main/java/edu/ufl/cise/klu/common/KLU_symbolic.java new file mode 100644 index 0000000..6633ee8 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_symbolic.java @@ -0,0 +1,64 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Symbolic object - contains the pre-ordering computed by klu_analyze. + */ +public class KLU_symbolic +{ + + /* A (P,Q) is in upper block triangular form. The kth block goes from + * row/col index R [k] to R [k+1]-1. The estimated number of nonzeros + * in the L factor of the kth block is Lnz [k]. + */ + + /* only computed if the AMD ordering is chosen: */ + double symmetry; /* symmetry of largest block */ + double est_flops; /* est. factorization flop count */ + double lnz, unz; /* estimated nz in L and U, including diagonals */ + double[] Lnz; /* size n, but only Lnz [0..nblocks-1] is used */ + + /* computed for all orderings: */ + int + n, /* input matrix A is n-by-n */ + nz, /* # entries in input matrix */ + nzoff, /* nz in off-diagonal blocks */ + nblocks, /* number of blocks */ + maxblock, /* size of largest block */ + ordering, /* ordering used (AMD, COLAMD, or GIVEN) */ + do_btf; /* whether or not BTF preordering was requested */ + + int[] + P, /* size n */ + Q, /* size n */ + R; /* size n+1, but only R [0..nblocks] is used */ + + /* only computed if BTF preordering requested */ + int structural_rank; /* 0 to n-1 if the matrix is structurally rank + * deficient. -1 if not computed. n if the matrix has + * full structural rank */ + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_version.java b/src/main/java/edu/ufl/cise/klu/common/KLU_version.java new file mode 100644 index 0000000..5b86395 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_version.java @@ -0,0 +1,47 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * All versions of KLU include these definitions. + * As an example, to test if the version you are using is 1.2 or later: + * + * if (KLU_VERSION >= KLU_VERSION_CODE (1,2)) ... + */ +public class KLU_version +{ + + public static String KLU_DATE = "Mar 24, 2009"; + public static int KLU_VERSION_CODE(int main, int sub) + { + return main * 1000 + sub; + } + public static int KLU_MAIN_VERSION = 1; + public static int KLU_SUB_VERSION = 1; + public static int KLU_SUBSUB_VERSION = 0; + public static int KLU_VERSION = KLU_VERSION_CODE(KLU_MAIN_VERSION, + KLU_SUB_VERSION); + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_z_factor.java b/src/main/java/edu/ufl/cise/klu/common/KLU_z_factor.java new file mode 100644 index 0000000..2db2b8e --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_z_factor.java @@ -0,0 +1,50 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Factors a matrix using the klu_analyze results. + * + * Complex version. + */ +public class KLU_z_factor +{ + + /** + * + * @param Ap size n+1, column pointers + * @param Ai size nz, row indices + * @param Ax size 2*nz, numerical values (real,imag pairs) + * @param Symbolic + * @param Common + * @return KLU_OK if OK, < 0 if error + */ + public static KLU_numeric klu_factor(int[] Ap, int[] Ai, double[] Ax, + KLU_symbolic Symbolic, KLU_common Common) + { + return null; + } + +} diff --git a/src/main/java/edu/ufl/cise/klu/common/KLU_zl_factor.java b/src/main/java/edu/ufl/cise/klu/common/KLU_zl_factor.java new file mode 100644 index 0000000..a746656 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/common/KLU_zl_factor.java @@ -0,0 +1,50 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.common; + +/** + * Factors a matrix using the klu_analyze results. + * + * Long / complex version. + */ +public class KLU_zl_factor +{ + + /** + * + * @param Ap size n+1, column pointers + * @param Ai size nz, row indices + * @param Ax size 2*nz, numerical values (real,imag pairs) + * @param Symbolic + * @param Common + * @return KLU_OK if OK, < 0 if error + */ + public static KLU_numeric klu_factor(long[] Ap, long[] Ai, double[] Ax, + KLU_l_symbolic Symbolic, KLU_l_common Common) + { + return null; + } + +} diff --git a/src/main/java/edu/ufl/cise/klu/tdouble/Dklu_version.java b/src/main/java/edu/ufl/cise/klu/tdouble/Dklu_version.java new file mode 100644 index 0000000..f13a0c2 --- /dev/null +++ b/src/main/java/edu/ufl/cise/klu/tdouble/Dklu_version.java @@ -0,0 +1,38 @@ +/** + * KLU: a sparse LU factorization algorithm. + * Copyright (C) 2004-2009, Timothy A. Davis. + * Copyright (C) 2011, Richard W. Lincoln. + * http://www.cise.ufl.edu/research/sparse/klu + * + * ------------------------------------------------------------------------- + * + * KLU is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * KLU 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this Module; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +package edu.ufl.cise.klu.tdouble; + +public class Dklu_version { + + public static int Int_MAX = 0x7fffffff; + + public static String Int_id = "%d"; + + public static int bytes(Object type, int n) + { + return sizeof(type * n); + } + +} -- 2.11.4.GIT