diff --git a/MathLib/LinAlg/Sparse/Sparsity.h b/MathLib/LinAlg/Sparse/Sparsity.h index e9a05ffecbe555a21c3de6f94a920e15dc5f8676..63d5ca099938b4c4735034e7a9535063b3315a74 100644 --- a/MathLib/LinAlg/Sparse/Sparsity.h +++ b/MathLib/LinAlg/Sparse/Sparsity.h @@ -24,22 +24,6 @@ namespace MathLib */ typedef std::vector<std::set<std::size_t> > RowMajorSparsity; -/** - * convert a row-major sparsity to CRS data - * - * @tparam INTTYPE index type - * @param row_major_entries Row-major sparse pattern - * @param n_rows The number of rows - * @param row_ptr Pointer to row index - * @param col_idx Pointer to column index - * @param nonzero The number of non-zero entries - * @param data Pointer to non-zero values - */ -template<class INTTYPE> -void convertRowMajorSparsityToCRS(const RowMajorSparsity &row_major_entries, std::size_t &n_rows, INTTYPE* &row_ptr, INTTYPE* &col_idx, std::size_t &nonzero, double* &data); - -} // end namespace MathLib - -#include "Sparsity.tpp" +} //MathLib #endif // SPARSITY_H_ diff --git a/MathLib/LinAlg/Sparse/Sparsity.tpp b/MathLib/LinAlg/Sparse/Sparsity.tpp deleted file mode 100644 index 6a41e5e611053997b4f52fc81fd694bdf0f70f47..0000000000000000000000000000000000000000 --- a/MathLib/LinAlg/Sparse/Sparsity.tpp +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - * - * \file Sparsity.tpp - * - * Created on 2012-12-03 by Norihiro Watanabe - */ - -#ifndef SPARSITY_TPP_ -#define SPARSITY_TPP_ - -#include <cassert> - -namespace MathLib -{ - -template<class INTTYPE> -void convertRowMajorSparsityToCRS(const RowMajorSparsity &row_major_entries, std::size_t &n_rows, INTTYPE* &row_ptr, INTTYPE* &col_idx, std::size_t &nonzero, double* &data) -{ - n_rows = row_major_entries.size(); - assert(n_rows > 0); - if (n_rows==0) return; - - // get the number of nonzero entries and store the locations in the nonzero - // vector that start a row - nonzero = 0; - row_ptr = new INTTYPE[n_rows+1]; - for (std::size_t i=0; i<n_rows; i++) { - row_ptr[i] = nonzero; // starting point of the row - nonzero += row_major_entries[i].size(); // entries at the i th row - } - row_ptr[n_rows] = nonzero; - - // store column indexes of nonzero entries - col_idx = new INTTYPE[nonzero]; - size_t cnt_entries = 0; - for (std::size_t i=0; i<n_rows; i++) { - const std::set<std::size_t> &setConnection = row_major_entries[i]; - for (std::set<std::size_t>::iterator it=setConnection.begin(); it!=setConnection.end(); ++it) { - col_idx[cnt_entries++] = *it; - } - } - - // allocate memory for nonzero entries - data = new double[nonzero]; - for (std::size_t i=0; i<nonzero; i++) - data[i] = .0; -} - -} // end namespace MathLib - -#endif // SPARSITY_TPP_