CppAD: A C++ Algorithmic Differentiation Package
20130102
|
void cppad_ipopt::sparse_map2vec | ( | const CppAD::vector< std::map< size_t, size_t > > | sparse, |
size_t & | n_nz, | ||
CppAD::vector< size_t > & | i_row, | ||
CppAD::vector< size_t > & | j_col | ||
) |
Create a two vector sparsity representation from a vector of maps.
sparse | Is a vector of maps representation of sparsity as well as the index in the two vector representation. To be specific; for(i = 0; i < sparse.size(); i++) { for(itr = sparse[i].begin(); itr != sparse[i].end(); itr++) { j = itr->first; // (i, j) is a possibly non-zero entry in sparsity pattern // k == itr->second, is corresponding index in i_row and j_col k++; } } |
n_nz | is the total number of possibly non-zero entries. |
i_row | The input size and element values for i_row do not matter. On output, it has size n_nz and i_row[k] contains the row index corresponding to the k-th possibly non-zero entry. |
j_col | The input size and element values for j_col do not matter. On output, it has size n_nz and j_col[k] contains the column index corresponding to the k-th possibly non-zero entry. |
Definition at line 58 of file sparse_map2vec.cpp.
Referenced by cppad_ipopt::cppad_ipopt_nlp::cppad_ipopt_nlp().