// Copyright (C) 2010-2015 National ICT Australia (NICTA) // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // ------------------------------------------------------------------- // // Written by Conrad Sanderson - http://conradsanderson.id.au //! \addtogroup fn_join //! @{ template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const Glue >::result join_cols(const T1& A, const T2& B) { arma_extra_debug_sigprint(); return Glue(A, B); } template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const Glue >::result join_vert(const T1& A, const T2& B) { arma_extra_debug_sigprint(); return Glue(A, B); } template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const Glue >::result join_rows(const T1& A, const T2& B) { arma_extra_debug_sigprint(); return Glue(A, B); } template inline typename enable_if2 < (is_arma_type::value && is_arma_type::value && is_same_type::value), const Glue >::result join_horiz(const T1& A, const T2& B) { arma_extra_debug_sigprint(); return Glue(A, B); } // // for cubes template inline const GlueCube join_slices(const BaseCube& A, const BaseCube& B) { arma_extra_debug_sigprint(); return GlueCube(A.get_ref(), B.get_ref()); } template inline Cube join_slices(const Base& A, const Base& B) { arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap UA(A.get_ref()); const unwrap UB(B.get_ref()); arma_debug_assert_same_size(UA.M.n_rows, UA.M.n_cols, UB.M.n_rows, UB.M.n_cols, "join_slices(): incompatible dimensions"); Cube out(UA.M.n_rows, UA.M.n_cols, 2); arrayops::copy(out.slice_memptr(0), UA.M.memptr(), UA.M.n_elem); arrayops::copy(out.slice_memptr(1), UB.M.memptr(), UB.M.n_elem); return out; } template inline Cube join_slices(const Base& A, const BaseCube& B) { arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap U(A.get_ref()); const Cube M(const_cast(U.M.memptr()), U.M.n_rows, U.M.n_cols, 1, false); return join_slices(M,B); } template inline Cube join_slices(const BaseCube& A, const Base& B) { arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap U(B.get_ref()); const Cube M(const_cast(U.M.memptr()), U.M.n_rows, U.M.n_cols, 1, false); return join_slices(A,M); } // // for sparse matrices template inline const SpGlue join_cols(const SpBase& A, const SpBase& B) { arma_extra_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template inline const SpGlue join_vert(const SpBase& A, const SpBase& B) { arma_extra_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template inline const SpGlue join_rows(const SpBase& A, const SpBase& B) { arma_extra_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template inline const SpGlue join_horiz(const SpBase& A, const SpBase& B) { arma_extra_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } //! @}