1 /* Siconos is a program dedicated to modeling, simulation and control 2 * of non smooth dynamical systems. 3 * 4 * Copyright 2021 INRIA. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 #ifndef NM_conversions_H 20 #define NM_conversions_H 21 22 /*!\file NM_conversions.h 23 \brief Conversion related functions for the various matrix storages in Numerics 24 */ 25 #include "SiconosConfig.h" // for BUILD_AS_CPP // IWYU pragma: keep 26 #include "CSparseMatrix.h" // for CSparseMatrix 27 28 #if defined(__cplusplus) && !defined(BUILD_AS_CPP) 29 extern "C" 30 { 31 #endif 32 33 /** Convert from csc to triplet (aka coo) 34 * \param csc the matrix to convert 35 * \return the matrix in triplet format 36 */ 37 CSparseMatrix* NM_csc_to_triplet(CSparseMatrix* csc); 38 39 /** Convert from csc to half triplet for symmetric matrices 40 * \param csc the matrix to convert 41 * \return the matrix in triplet format 42 */ 43 CSparseMatrix* NM_csc_to_half_triplet(CSparseMatrix* csc); 44 45 /** Convert from triplet (aka coo) to csr 46 * \param triplet the matrix to convert 47 * \return the matrix in csr format 48 */ 49 CSparseMatrix* NM_triplet_to_csr(CSparseMatrix* triplet); 50 51 /** Convert from csr to triplet (aka coo) 52 * \param csr the matrix to convert 53 * \return the matrix in triplet format 54 */ 55 CSparseMatrix* NM_csr_to_triplet(CSparseMatrix* csr); 56 57 /** Convert from csc to csr 58 * \param csc the matrix to convert 59 * \return the matrix in csr format 60 */ 61 CSparseMatrix* NM_csc_to_csr(CSparseMatrix* csc); 62 63 /** Convert from csr to csc 64 * \param csr the matrix to convert 65 * \return the matrix in csc format 66 */ 67 CSparseMatrix* NM_csr_to_csc(CSparseMatrix* csr); 68 69 #if defined(__cplusplus) && !defined(BUILD_AS_CPP) 70 } 71 #endif 72 73 #endif 74