00001 /* 00002 * Copyright Bruno Pinçon, ESIAL-IECN, Inria CORIDA project 00003 * <bruno.pincon@iecn.u-nancy.fr> 00004 * contributor: Antonio Manoel Ferreria Frasson, Universidade Federal do 00005 * Espírito Santo, Brazil. <frasson@ele.ufes.br>. 00006 * 00007 * PURPOSE: Scilab interfaces routines onto the UMFPACK sparse solver 00008 * (Tim Davis) and onto the TAUCS snmf choleski solver (Sivan Teledo) 00009 * 00010 * This software is governed by the CeCILL license under French law and 00011 * abiding by the rules of distribution of free software. You can use, 00012 * modify and/or redistribute the software under the terms of the CeCILL 00013 * license as circulated by CEA, CNRS and INRIA at the following URL 00014 * "http://www.cecill.info". 00015 * 00016 * As a counterpart to the access to the source code and rights to copy, 00017 * modify and redistribute granted by the license, users are provided only 00018 * with a limited warranty and the software's author, the holder of the 00019 * economic rights, and the successive licensors have only limited 00020 * liability. 00021 * 00022 * In this respect, the user's attention is drawn to the risks associated 00023 * with loading, using, modifying and/or developing or reproducing the 00024 * software by the user in light of its specific status of free software, 00025 * that may mean that it is complicated to manipulate, and that also 00026 * therefore means that it is reserved for developers and experienced 00027 * professionals having in-depth computer knowledge. Users are therefore 00028 * encouraged to load and test the software's suitability as regards their 00029 * requirements in conditions enabling the security of their systems and/or 00030 * data to be ensured and, more generally, to use and operate it in the 00031 * same conditions as regards security. 00032 * 00033 * The fact that you are presently reading this means that you have had 00034 * knowledge of the CeCILL license and that you accept its terms. 00035 * 00036 */ 00037 #include "machine.h" 00038 #ifdef UMFPACK_SUITESPARSE 00039 #include <suitesparse/umfpack.h> 00040 #else 00041 #include <umfpack.h> 00042 #endif 00043 #include "stackTypeVariable.h" 00044 00045 enum {NOT_ENOUGH_PLACE_IN_STK, MAT_IS_NOT_SPD, A_PRIORI_OK}; /* flags for spd_sci_sparse_to_taucs_sparse */ 00046 00047 typedef void * Adr; 00048 00049 typedef struct _CellAdr CellAdr ; 00050 struct _CellAdr { 00051 Adr adr; 00052 int it; // added to see if the LU factors comes from a real or complex matrix 00053 CellAdr *next; 00054 }; 00055 00056 typedef struct /* a type to handle a choleski factorisation */ 00057 { 00058 int * p; /* for the permutation */ 00059 void * C; /* for the factor (lower) */ 00060 int n; /* to stay the order (in place to read a member of C) */ 00061 } taucs_handle_factors; 00062 00063 typedef struct { 00064 int m; /* number of rows */ 00065 int n; /* number of columns */ 00066 int nel; /* number of non nuls elements */ 00067 int it; /* flag type : it=-1 (boolean) it=0 (real) it=1 (complex) */ 00068 int *p; /* n+1 array : ptr_col[n] must be equal to nel */ 00069 int *irow; 00070 double *R; 00071 double *I; 00072 } CcsSparse; 00073 00074 #define SciSparseToCcsSparse(num, A, B) if (! sci_sparse_to_ccs_sparse(num, A, B)) { return 0;} 00075
1.5.5