Index: traits/ublas_sparse.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/numeric/bindings/traits/ublas_sparse.hpp,v retrieving revision 1.2 diff -u -r1.2 ublas_sparse.hpp --- traits/ublas_sparse.hpp 6 Jan 2005 07:29:39 -0000 1.2 +++ traits/ublas_sparse.hpp 10 Mar 2005 16:00:29 -0000 @@ -69,8 +69,7 @@ BOOST_STATIC_CONSTANT (std::size_t, index_base = IB); static index_pointer index1_storage (matrix_type& cm) { - if ( cm.filled1()<=ordering_type::size1(cm.size1(), cm.size2()) ) - std::fill( cm.index1_data().begin()+cm.filled1(), cm.index1_data().begin()+ordering_type::size1(cm.size1(), cm.size2())+1, cm.filled2() ) ; + cm.complete_index1_data(); return vector_traits::storage (cm.index1_data()); } static index_pointer index2_storage (matrix_type& cm) { Index: umfpack/umfpack.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/numeric/bindings/umfpack/umfpack.hpp,v retrieving revision 1.1 diff -u -r1.1 umfpack.hpp --- umfpack/umfpack.hpp 4 Sep 2003 10:25:56 -0000 1.1 +++ umfpack/umfpack.hpp 10 Mar 2005 16:00:29 -0000 @@ -29,6 +29,24 @@ namespace boost { namespace numeric { namespace bindings { namespace umfpack { + struct index_array_caster_to_int { + template + static const int *cast(const T *iarray) { + return reinterpret_cast(iarray); + } + }; + + struct index_array_caster_no_op { + template + static const int *cast(const T *iarray) { + /* If you see a type conversion error in this return, + * you need to use index_array_caster_to_int. + */ + return iarray; + } + }; + + class as_is_index_array {}; template struct symbolic_type : private noncopyable { @@ -99,40 +117,43 @@ */ namespace detail { - template + template inline int symbolic (traits::compressed_t, MatrA const& A, void **Symbolic, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { return detail::symbolic (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), - traits::spmatrix_index1_storage (A), - traits::spmatrix_index2_storage (A), + IAC::cast (traits::spmatrix_index1_storage (A)), + IAC::cast (traits::spmatrix_index2_storage (A)), traits::spmatrix_value_storage (A), Symbolic, Control, Info); } - template + template inline int symbolic (traits::compressed_t, MatrA const& A, QVec const& Qinit, void **Symbolic, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { return detail::qsymbolic (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), - traits::spmatrix_index1_storage (A), - traits::spmatrix_index2_storage (A), + IAC::cast(traits::spmatrix_index1_storage (A)), + IAC::cast(traits::spmatrix_index2_storage (A)), traits::spmatrix_value_storage (A), traits::vector_storage (Qinit), Symbolic, Control, Info); } - template + template inline int symbolic (traits::coordinate_t, MatrA const& A, void **Symbolic, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { int n_row = traits::spmatrix_size1 (A); int n_col = traits::spmatrix_size2 (A); @@ -140,8 +161,8 @@ typedef typename traits::sparse_matrix_traits::value_type val_t; - int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); + int const* Ti = IAC::cast (traits::spmatrix_index2_storage (A)); + int const* Tj = IAC::cast (traits::spmatrix_index1_storage (A)); traits::detail::array Ap (n_col+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; traits::detail::array Ai (nnz); @@ -159,11 +180,12 @@ Symbolic, Control, Info); } - template + template inline int symbolic (traits::coordinate_t, MatrA const& A, QVec const& Qinit, void **Symbolic, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { int n_row = traits::spmatrix_size1 (A); int n_col = traits::spmatrix_size2 (A); @@ -171,8 +193,8 @@ typedef typename traits::sparse_matrix_traits::value_type val_t; - int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); + int const* Ti = IAC::cast (traits::spmatrix_index2_storage (A)); + int const* Tj = IAC::cast (traits::spmatrix_index1_storage (A)); traits::detail::array Ap (n_col+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; traits::detail::array Ai (nnz); @@ -193,13 +215,14 @@ } // detail - template + template inline int symbolic (MatrA const& A, symbolic_type< typename traits::sparse_matrix_traits::value_type >& Symbolic, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< @@ -224,10 +247,10 @@ )); #endif - return detail::symbolic (storage_f(), A, &Symbolic.ptr, Control, Info); + return detail::symbolic (storage_f(), A, &Symbolic.ptr, Control, Info, IAC()); } - template + template inline int symbolic (MatrA const& A, symbolic_type< @@ -238,12 +261,14 @@ > const& Control, info_type< typename traits::sparse_matrix_traits::value_type - >& Info) + >& Info, + IAC) { - return symbolic (A, Symbolic, Control.ptr, Info.ptr); + return symbolic (A, Symbolic, Control.ptr, Info.ptr, + IAC()); } - template + template inline int symbolic (MatrA const& A, symbolic_type< @@ -251,18 +276,20 @@ >& Symbolic, control_type< typename traits::sparse_matrix_traits::value_type - > const& Control) + > const& Control, + IAC) { - return symbolic (A, Symbolic, Control.ptr); + return symbolic (A, Symbolic, Control.ptr, IAC()); } - template + template inline int symbolic (MatrA const& A, QVec const& Qinit, symbolic_type< typename traits::sparse_matrix_traits::value_type >& Symbolic, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< @@ -293,7 +320,7 @@ &Symbolic.ptr, Control, Info); } - template + template inline int symbolic (MatrA const& A, QVec const& Qinit, symbolic_type< @@ -304,11 +331,99 @@ > const& Control, info_type< typename traits::sparse_matrix_traits::value_type - >& Info) + >& Info, + IAC) { return symbolic (A, Qinit, Symbolic, Control.ptr, Info.ptr); } + template + inline + int symbolic (MatrA const& A, QVec const& Qinit, + symbolic_type< + typename traits::sparse_matrix_traits::value_type + >& Symbolic, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + IAC) + { + return symbolic (A, Qinit, Symbolic, Control.ptr); + } + + // IAC-less + template + inline + int symbolic (MatrA const& A, + symbolic_type< + typename traits::sparse_matrix_traits::value_type + >& Symbolic, + double const* Control = 0, double* Info = 0) + { + return symbolic(A, Symbolic, Control, Info, + index_array_caster_no_op()); + } + + template + inline + int symbolic (MatrA const& A, + symbolic_type< + typename traits::sparse_matrix_traits::value_type + >& Symbolic, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + info_type< + typename traits::sparse_matrix_traits::value_type + >& Info) + { + return symbolic (A, Symbolic, Control, Info, + index_array_caster_no_op()); + } + + template + inline + int symbolic (MatrA const& A, + symbolic_type< + typename traits::sparse_matrix_traits::value_type + >& Symbolic, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control) + { + return symbolic(A, Symbolic, Control, + index_array_caster_no_op()); + } + + template + inline + int symbolic (MatrA const& A, QVec const& Qinit, + symbolic_type< + typename traits::sparse_matrix_traits::value_type + >& Symbolic, + double const* Control = 0, double* Info = 0) + { + return symbolic(A, Symbolic, Control, Info, + index_array_caster_no_op()); + } + + template + inline + int symbolic (MatrA const& A, QVec const& Qinit, + symbolic_type< + typename traits::sparse_matrix_traits::value_type + >& Symbolic, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + info_type< + typename traits::sparse_matrix_traits::value_type + >& Info) + { + return symbolic(A, Symbolic, Control, Info, + index_array_caster_no_op()); + } + template inline int symbolic (MatrA const& A, QVec const& Qinit, @@ -319,7 +434,8 @@ typename traits::sparse_matrix_traits::value_type > const& Control) { - return symbolic (A, Qinit, Symbolic, Control.ptr); + return symbolic(A, Symbolic, Control, + index_array_caster_no_op()); } @@-335,25 +451,27 @@ */ namespace detail { - template + template inline int numeric (traits::compressed_t, MatrA const& A, void *Symbolic, void** Numeric, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { return detail::numeric (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), - traits::spmatrix_index1_storage (A), - traits::spmatrix_index2_storage (A), + IAC::cast (traits::spmatrix_index1_storage (A)), + IAC::cast (traits::spmatrix_index2_storage (A)), traits::spmatrix_value_storage (A), Symbolic, Numeric, Control, Info); } - template + template inline int numeric (traits::coordinate_t, MatrA const& A, void *Symbolic, void** Numeric, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { int n_row = traits::spmatrix_size1 (A); int n_col = traits::spmatrix_size2 (A); @@ -361,8 +479,8 @@ typedef typename traits::sparse_matrix_traits::value_type val_t; - int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); + int const* Ti = IAC::cast (traits::spmatrix_index2_storage (A)); + int const* Tj = IAC::cast (traits::spmatrix_index1_storage (A)); traits::detail::array Ap (n_col+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; traits::detail::array Ai (nnz); @@ -382,7 +500,7 @@ } // detail - template + template inline int numeric (MatrA const& A, symbolic_type< @@ -391,7 +509,8 @@ numeric_type< typename traits::sparse_matrix_traits::value_type >& Numeric, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< @@ -417,10 +536,11 @@ #endif return detail::numeric (storage_f(), A, - Symbolic.ptr, &Numeric.ptr, Control, Info); + Symbolic.ptr, &Numeric.ptr, Control, Info, + IAC()); } - template + template inline int numeric (MatrA const& A, symbolic_type< @@ -434,12 +554,69 @@ > const& Control, info_type< typename traits::sparse_matrix_traits::value_type - >& Info) + >& Info, + IAC) { // g++ (3.2) is unable to distinguish // function numeric() and namespace boost::numeric ;o) - return umfpack::numeric (A, Symbolic, Numeric, Control.ptr, Info.ptr); + return umfpack::numeric (A, Symbolic, Numeric, Control.ptr, Info.ptr, + IAC()); + } + + template + inline + int numeric (MatrA const& A, + symbolic_type< + typename traits::sparse_matrix_traits::value_type + > const& Symbolic, + numeric_type< + typename traits::sparse_matrix_traits::value_type + >& Numeric, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + IAC) + { + return umfpack::numeric (A, Symbolic, Numeric, + Control.ptr, IAC()); + } + + // IAC-less + template + inline + int numeric (MatrA const& A, + symbolic_type< + typename traits::sparse_matrix_traits::value_type + > const& Symbolic, + numeric_type< + typename traits::sparse_matrix_traits::value_type + >& Numeric, + double const* Control = 0, double* Info = 0) + { + umfpack::numeric (A, Symbolic, Numeric, Control, Info, + index_array_caster_no_op()); + } + + template + inline + int numeric (MatrA const& A, + symbolic_type< + typename traits::sparse_matrix_traits::value_type + > const& Symbolic, + numeric_type< + typename traits::sparse_matrix_traits::value_type + >& Numeric, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + info_type< + typename traits::sparse_matrix_traits::value_type + >& Info) + + { + umfpack::numeric (A, Symbolic, Numeric, Control, Info, + index_array_caster_no_op()); } template @@ -455,7 +632,8 @@ typename traits::sparse_matrix_traits::value_type > const& Control) { - return umfpack::numeric (A, Symbolic, Numeric, Control.ptr); + umfpack::numeric (A, Symbolic, Numeric, Control, + index_array_caster_no_op()); } @@ -465,10 +643,11 @@ */ namespace detail { - template + template inline int factor (traits::compressed_t, MatrA const& A, - void** Numeric, double const* Control = 0, double* Info = 0) + void** Numeric, double const* Control, double* Info, + IAC) { symbolic_type::value_type> Symbolic; @@ -476,24 +655,25 @@ int status; status = detail::symbolic (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), - traits::spmatrix_index1_storage (A), - traits::spmatrix_index2_storage (A), + IAC::cast (traits::spmatrix_index1_storage (A)), + IAC::cast (traits::spmatrix_index2_storage (A)), traits::spmatrix_value_storage (A), &Symbolic.ptr, Control, Info); if (status != UMFPACK_OK) return status; return detail::numeric (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), - traits::spmatrix_index1_storage (A), - traits::spmatrix_index2_storage (A), + IAC::cast (traits::spmatrix_index1_storage (A)), + IAC::cast (traits::spmatrix_index2_storage (A)), traits::spmatrix_value_storage (A), Symbolic.ptr, Numeric, Control, Info); } - template + template inline int factor (traits::coordinate_t, MatrA const& A, - void** Numeric, double const* Control = 0, double* Info = 0) + void** Numeric, double const* Control, double* Info, + IAC) { int n_row = traits::spmatrix_size1 (A); int n_col = traits::spmatrix_size2 (A); @@ -501,8 +681,8 @@ typedef typename traits::sparse_matrix_traits::value_type val_t; - int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); + int const* Ti = IAC::cast (traits::spmatrix_index2_storage (A)); + int const* Tj = IAC::cast (traits::spmatrix_index1_storage (A)); traits::detail::array Ap (n_col+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; traits::detail::array Ai (nnz); @@ -531,13 +711,14 @@ } // detail - template + template inline int factor (MatrA const& A, numeric_type< typename traits::sparse_matrix_traits::value_type >& Numeric, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< @@ -562,7 +743,50 @@ )); #endif - return detail::factor (storage_f(), A, &Numeric.ptr, Control, Info); + return detail::factor (storage_f(), A, &Numeric.ptr, Control, Info, IAC()); + } + + template + inline + int factor (MatrA const& A, + numeric_type< + typename traits::sparse_matrix_traits::value_type + >& Numeric, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + info_type< + typename traits::sparse_matrix_traits::value_type + >& Info, + IAC) + { + return factor (A, Numeric, Control.ptr, Info.ptr, IAC()); + } + + template + inline + int factor (MatrA const& A, + numeric_type< + typename traits::sparse_matrix_traits::value_type + >& Numeric, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + IAC) + { + return factor (A, Numeric, Control.ptr, IAC()); + } + + // IAC-less + template + inline + int factor (MatrA const& A, + numeric_type< + typename traits::sparse_matrix_traits::value_type + >& Numeric, + double const* Control = 0, double* Info = 0) + { + return factor(A, Numeric, Control, Info, index_array_caster_no_op()); } template @@ -576,9 +800,9 @@ > const& Control, info_type< typename traits::sparse_matrix_traits::value_type - >& Info) + >& Info) { - return factor (A, Numeric, Control.ptr, Info.ptr); + return factor (A, Numeric, Control.ptr, Info.ptr, index_array_caster_no_op()); } template @@ -591,7 +815,7 @@ typename traits::sparse_matrix_traits::value_type > const& Control) { - return factor (A, Numeric, Control.ptr); + return factor (A, Numeric, Control.ptr, index_array_caster_no_op()); } @@ -603,26 +827,32 @@ */ namespace detail { - template + template inline int solve (traits::compressed_t, int sys, MatrA const& A, VecX& X, VecB const& B, - void *Numeric, double const* Control = 0, double* Info = 0) + void *Numeric, double const* Control, + double* Info, + IAC) { return detail::solve (sys, traits::spmatrix_size1 (A), - traits::spmatrix_index1_storage (A), - traits::spmatrix_index2_storage (A), + IAC::cast (traits::spmatrix_index1_storage (A)), + IAC::cast (traits::spmatrix_index2_storage (A)), traits::spmatrix_value_storage (A), traits::vector_storage (X), traits::vector_storage (B), Numeric, Control, Info); } - template + template inline int solve (traits::coordinate_t, int sys, MatrA const& A, VecX& X, VecB const& B, - void *Numeric, double const* Control = 0, double* Info = 0) + void *Numeric, double const* Control = 0, + double* Info = 0, + IAC) { int n = traits::spmatrix_size1 (A); @@ -630,8 +860,8 @@ typedef typename traits::sparse_matrix_traits::value_type val_t; - int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); + int const* Ti = IAC::cast (traits::spmatrix_index2_storage (A)); + int const* Tj = IAC::cast (traits::spmatrix_index1_storage (A)); traits::detail::array Ap (n+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; traits::detail::array Ai (nnz); @@ -652,13 +882,13 @@ } // detail - template + template inline int solve (int sys, MatrA const& A, VecX& X, VecB const& B, numeric_type< typename traits::sparse_matrix_traits::value_type > const& Numeric, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, IAC) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< @@ -688,7 +918,99 @@ assert (traits::spmatrix_size2 (A) == traits::vector_size (B)); return detail::solve (storage_f(), sys, A, X, B, - Numeric.ptr, Control, Info); + Numeric.ptr, Control, Info, IAC()); + } + + template + inline + int solve (int sys, MatrA const& A, VecX& X, VecB const& B, + numeric_type< + typename traits::sparse_matrix_traits::value_type + > const& Numeric, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + info_type< + typename traits::sparse_matrix_traits::value_type + >& Info, + IAC) + { + return solve (sys, A, X, B, Numeric, Control.ptr, + Info.ptr, IAC()); + } + + template + inline + int solve (int sys, MatrA const& A, VecX& X, VecB const& B, + numeric_type< + typename traits::sparse_matrix_traits::value_type + > const& Numeric, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + IAC) + { + return solve (sys, A, X, B, Numeric, Control.ptr, + IAC()); + } + + template + inline + int solve (MatrA const& A, VecX& X, VecB const& B, + numeric_type< + typename traits::sparse_matrix_traits::value_type + > const& Numeric, + double const* Control, double* Info, IAC) + { + return solve (UMFPACK_A, A, X, B, Numeric, + Control, Info, IAC()); + } + + template + inline + int solve (MatrA const& A, VecX& X, VecB const& B, + numeric_type< + typename traits::sparse_matrix_traits::value_type + > const& Numeric, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + info_type< + typename traits::sparse_matrix_traits::value_type + >& Info, + IAC) + { + return solve (UMFPACK_A, A, X, B, Numeric, + Control.ptr, Info.ptr, IAC()); + } + + template + inline + int solve (MatrA const& A, VecX& X, VecB const& B, + numeric_type< + typename traits::sparse_matrix_traits::value_type + > const& Numeric, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + IAC) + { + return solve (UMFPACK_A, A, X, B, Numeric, Control.ptr, + IAC()); + } + + // IAC-less + template + inline + int solve (int sys, MatrA const& A, VecX& X, VecB const& B, + numeric_type< + typename traits::sparse_matrix_traits::value_type + > const& Numeric, + double const* Control = 0, double* Info = 0) + { + return solve(sys, A, X, B, Numeric, Control, Info, + index_array_caster_no_op()); } template @@ -702,9 +1024,10 @@ > const& Control, info_type< typename traits::sparse_matrix_traits::value_type - >& Info) + >& Info) { - return solve (sys, A, X, B, Numeric, Control.ptr, Info.ptr); + return solve(sys, A, X, B, Numeric, Control, Info, + index_array_caster_no_op()); } template @@ -717,7 +1040,8 @@ typename traits::sparse_matrix_traits::value_type > const& Control) { - return solve (sys, A, X, B, Numeric, Control.ptr); + return solve(sys, A, X, B, Numeric, Control, + index_array_caster_no_op()); } template @@ -728,7 +1052,8 @@ > const& Numeric, double const* Control = 0, double* Info = 0) { - return solve (UMFPACK_A, A, X, B, Numeric, Control, Info); + return solve(A, X, B, Numeric, Control, Info, + index_array_caster_no_op()); } template @@ -742,10 +1067,10 @@ > const& Control, info_type< typename traits::sparse_matrix_traits::value_type - >& Info) + >& Info) { - return solve (UMFPACK_A, A, X, B, Numeric, - Control.ptr, Info.ptr); + return solve(A, X, B, Numeric, Control, Info, + index_array_caster_no_op()); } template @@ -758,7 +1083,8 @@ typename traits::sparse_matrix_traits::value_type > const& Control) { - return solve (UMFPACK_A, A, X, B, Numeric, Control.ptr); + return solve(A, X, B, Numeric, Control, + index_array_caster_no_op()); } @@ -768,11 +1094,13 @@ */ namespace detail { - template + template inline int umf_solve (traits::compressed_t, MatrA const& A, VecX& X, VecB const& B, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { symbolic_type::value_type> Symbolic; @@ -782,34 +1110,36 @@ int status; status = detail::symbolic (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), - traits::spmatrix_index1_storage (A), - traits::spmatrix_index2_storage (A), + IAC::cast (traits::spmatrix_index1_storage (A)), + IAC::cast (traits::spmatrix_index2_storage (A)), traits::spmatrix_value_storage (A), &Symbolic.ptr, Control, Info); if (status != UMFPACK_OK) return status; status = detail::numeric (traits::spmatrix_size1 (A), traits::spmatrix_size2 (A), - traits::spmatrix_index1_storage (A), - traits::spmatrix_index2_storage (A), + IAC::cast (traits::spmatrix_index1_storage (A)), + IAC::cast (traits::spmatrix_index2_storage (A)), traits::spmatrix_value_storage (A), Symbolic.ptr, &Numeric.ptr, Control, Info); if (status != UMFPACK_OK) return status; return detail::solve (UMFPACK_A, traits::spmatrix_size1 (A), - traits::spmatrix_index1_storage (A), - traits::spmatrix_index2_storage (A), + IAC::cast (traits::spmatrix_index1_storage (A)), + IAC::cast (traits::spmatrix_index2_storage (A)), traits::spmatrix_value_storage (A), traits::vector_storage (X), traits::vector_storage (B), Numeric.ptr, Control, Info); } - template + template inline int umf_solve (traits::coordinate_t, MatrA const& A, VecX& X, VecB const& B, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { int n_row = traits::spmatrix_size1 (A); int n_col = traits::spmatrix_size2 (A); @@ -817,8 +1147,8 @@ typedef typename traits::sparse_matrix_traits::value_type val_t; - int const* Ti = traits::spmatrix_index2_storage (A); - int const* Tj = traits::spmatrix_index1_storage (A); + int const* Ti = IAC::cast (traits::spmatrix_index2_storage (A)); + int const* Tj = IAC::cast (traits::spmatrix_index1_storage (A)); traits::detail::array Ap (n_col+1); if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory; traits::detail::array Ai (nnz); @@ -856,10 +1186,12 @@ } // detail - template + template inline int umf_solve (MatrA const& A, VecX& X, VecB const& B, - double const* Control = 0, double* Info = 0) + double const* Control, double* Info, + IAC) { #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK BOOST_STATIC_ASSERT((boost::is_same< @@ -891,6 +1223,43 @@ return detail::umf_solve (storage_f(), A, X, B, Control, Info); } + template + inline + int umf_solve (MatrA const& A, VecX& X, VecB const& B, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + info_type< + typename traits::sparse_matrix_traits::value_type + >& Info, + IAC) + { + return umf_solve (A, X, B, Control.ptr, Info.ptr); + } + + template + inline + int umf_solve (MatrA const& A, VecX& X, VecB const& B, + control_type< + typename traits::sparse_matrix_traits::value_type + > const& Control, + IAC) + { + return umf_solve (A, X, B, Control.ptr); + } + + // IAC-less + template + inline + int umf_solve (MatrA const& A, VecX& X, VecB const& B, + double const* Control = 0, double* Info = 0) + { + return umf_solve(A, X, B, Control, Info, + index_array_caster_no_op()); + } + template inline int umf_solve (MatrA const& A, VecX& X, VecB const& B, @@ -901,7 +1270,8 @@ typename traits::sparse_matrix_traits::value_type >& Info) { - return umf_solve (A, X, B, Control.ptr, Info.ptr); + return umf_solve(A, X, B, Control, Info, + index_array_caster_no_op()); } template @@ -911,10 +1281,10 @@ typename traits::sparse_matrix_traits::value_type > const& Control) { - return umf_solve (A, X, B, Control.ptr); + return umf_solve(A, X, B, Control, + index_array_caster_no_op()); } - /////////////////////// // matrix manipulations ///////////////////////