prepare_lhs.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_MATLAB_PREPARE_LHS_H
  9. #define IGL_MATLAB_PREPARE_LHS_H
  10. #include "../igl_inline.h"
  11. #include <mex.h>
  12. #include <Eigen/Dense>
  13. #include <Eigen/Sparse>
  14. namespace igl
  15. {
  16. namespace matlab
  17. {
  18. /// Writes out a matrix as a double
  19. ///
  20. /// @param[in] V M by N matrix
  21. /// @param[out] plhs points to lhs argument
  22. template <typename DerivedV>
  23. IGL_INLINE void prepare_lhs_double(
  24. const Eigen::DenseBase<DerivedV> & V,
  25. mxArray *plhs[]);
  26. /// \overload
  27. template <typename Vtype>
  28. IGL_INLINE void prepare_lhs_double(
  29. const Eigen::SparseMatrix<Vtype> & V,
  30. mxArray *plhs[]);
  31. /// \overload
  32. /// \brief Casts to logical
  33. template <typename DerivedV>
  34. IGL_INLINE void prepare_lhs_logical(
  35. const Eigen::DenseBase<DerivedV> & V,
  36. mxArray *plhs[]);
  37. /// Writes out a matrix and adds 1
  38. ///
  39. /// @param[in] V M by N matrix
  40. /// @param[out] plhs points to lhs argument
  41. template <typename DerivedV>
  42. IGL_INLINE void prepare_lhs_index(
  43. const Eigen::DenseBase<DerivedV> & V,
  44. mxArray *plhs[]);
  45. /// \overload
  46. /// \brief Vector of matrices -> cell array of matrices
  47. /// @param[in] V vector of M by N matrices
  48. template <typename Vtype>
  49. IGL_INLINE void prepare_lhs_double(
  50. const std::vector<Vtype> & V,
  51. mxArray *plhs[]);
  52. };
  53. }
  54. #ifndef IGL_STATIC_LIBRARY
  55. # include "prepare_lhs.cpp"
  56. #endif
  57. #endif