CppAD: A C++ Algorithmic Differentiation Package
20130918
|
00001 /* $Id$ */ 00002 /* -------------------------------------------------------------------------- 00003 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell 00004 00005 CppAD is distributed under multiple licenses. This distribution is under 00006 the terms of the 00007 Eclipse Public License Version 1.0. 00008 00009 A copy of this license is included in the COPYING file of this distribution. 00010 Please visit http://www.coin-or.org/CppAD/ for information on other licenses. 00011 -------------------------------------------------------------------------- */ 00012 # ifndef CPPAD_CPPAD_COLPACK_INCLUDED 00013 # define CPPAD_CPPAD_COLPACK_INCLUDED 00014 # if CPPAD_HAS_COLPACK 00015 00016 namespace CppAD { // BEGIN_CPPAD_NAMESPACE 00017 /*! 00018 \file cppad_colpack.hpp 00019 External interface to Colpack routines used by cppad. 00020 */ 00021 // --------------------------------------------------------------------------- 00022 /*! 00023 Link from CppAD to ColPack used for general sparse matrices. 00024 00025 This CppAD library routine is necessary because 00026 <code>ColPack/ColPackHeaders.h</code> has a 00027 <code>using namespace std</code> at the global level. 00028 00029 \param m [in] 00030 is the number of rows in the sparse matrix 00031 00032 \param n [in] 00033 is the nubmer of columns in the sparse matrix. 00034 00035 \param adolc_pattern [in] 00036 This vector has size \c m, 00037 <code>adolc_pattern[i][0]</code> is the number of non-zeros in row \c i. 00038 For <code>j = 1 , ... , adolc_sparsity[i]<code>, 00039 <code>adolc_pattern[i][j]</code> is the column index (base zero) for the 00040 non-zeros in row \c i. 00041 00042 \param color [out] 00043 is a vector with size \c m. 00044 The input value of its elements does not matter. 00045 Upon return, it is a coloring for the rows of the sparse matrix. 00046 \n 00047 \n 00048 If for some \c i, <code>color[i] == m</code>, then 00049 <code>adolc_pattern[i][0] == 0</code>. 00050 Otherwise, <code>color[i] < m</code>. 00051 \n 00052 \n 00053 Suppose two differen rows, <code>i != r</code> have the same color. 00054 It follows that for all column indices \c j; 00055 it is not the case that both 00056 <code>(i, j)</code> and <code>(r, j)</code> appear in the sparsity pattern. 00057 \n 00058 \n 00059 This routine tries to minimize, with respect to the choice of colors, 00060 the number of colors. 00061 */ 00062 extern void cppad_colpack_general( 00063 CppAD::vector<size_t>& color , 00064 size_t m , 00065 size_t n , 00066 const CppAD::vector<unsigned int*>& adolc_pattern 00067 ); 00068 00069 /*! 00070 Link from CppAD to ColPack used for symmetric sparse matrices 00071 (not yet used or tested). 00072 00073 This CppAD library routine is necessary because 00074 <code>ColPack/ColPackHeaders.h</code> has a 00075 <code>using namespace std</code> at the global level. 00076 00077 \param n [in] 00078 is the nubmer of rows and columns in the symmetric sparse matrix. 00079 00080 \param adolc_pattern [in] 00081 This vector has size \c n, 00082 <code>adolc_pattern[i][0]</code> is the number of non-zeros in row \c i. 00083 For <code>j = 1 , ... , adolc_sparsity[i]<code>, 00084 <code>adolc_pattern[i][j]</code> is the column index (base zero) for the 00085 non-zeros in row \c i. 00086 00087 \param color [out] 00088 The input value of its elements does not matter. 00089 Upon return, it is a coloring for the rows of the sparse matrix. 00090 The properties of this coloring have not yet been determined; see 00091 Efficient Computation of Sparse Hessians Using Coloring 00092 and Automatic Differentiation (pdf/ad/gebemedhin14.pdf) 00093 */ 00094 extern void cppad_colpack_symmetric( 00095 CppAD::vector<size_t>& color , 00096 size_t n , 00097 const CppAD::vector<unsigned int*>& adolc_pattern 00098 ); 00099 00100 } // END_CPPAD_NAMESPACE 00101 00102 # endif 00103 # endif 00104