// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup fn_join //! @{ template arma_warn_unused 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 arma_warn_unused inline Mat join_cols(const Base& A, const Base& B, const Base& C) { arma_extra_debug_sigprint(); Mat out; glue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline Mat join_cols(const Base& A, const Base& B, const Base& C, const Base& D) { arma_extra_debug_sigprint(); Mat out; glue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused 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 arma_warn_unused inline Mat join_vert(const Base& A, const Base& B, const Base& C) { arma_extra_debug_sigprint(); Mat out; glue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline Mat join_vert(const Base& A, const Base& B, const Base& C, const Base& D) { arma_extra_debug_sigprint(); Mat out; glue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused 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 arma_warn_unused inline Mat join_rows(const Base& A, const Base& B, const Base& C) { arma_extra_debug_sigprint(); Mat out; glue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline Mat join_rows(const Base& A, const Base& B, const Base& C, const Base& D) { arma_extra_debug_sigprint(); Mat out; glue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused 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); } template arma_warn_unused inline Mat join_horiz(const Base& A, const Base& B, const Base& C) { arma_extra_debug_sigprint(); Mat out; glue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline Mat join_horiz(const Base& A, const Base& B, const Base& C, const Base& D) { arma_extra_debug_sigprint(); Mat out; glue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } // // for cubes template arma_warn_unused inline const GlueCube join_slices(const BaseCube& A, const BaseCube& B) { arma_extra_debug_sigprint(); return GlueCube(A.get_ref(), B.get_ref()); } template arma_warn_unused inline Cube join_slices(const Base& A, const Base& B) { arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_unwrap UA(A.get_ref()); const quasi_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, arma_nozeros_indicator()); 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 arma_warn_unused inline Cube join_slices(const Base& A, const BaseCube& B) { arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_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 arma_warn_unused inline Cube join_slices(const BaseCube& A, const Base& B) { arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const quasi_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 arma_warn_unused inline const SpGlue join_cols(const SpBase& A, const SpBase& B) { arma_extra_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template arma_warn_unused inline SpMat join_cols(const SpBase& A, const SpBase& B, const SpBase& C) { arma_extra_debug_sigprint(); SpMat out; spglue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline SpMat join_cols(const SpBase& A, const SpBase& B, const SpBase& C, const SpBase& D) { arma_extra_debug_sigprint(); SpMat out; spglue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused inline const SpGlue join_vert(const SpBase& A, const SpBase& B) { arma_extra_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template arma_warn_unused inline SpMat join_vert(const SpBase& A, const SpBase& B, const SpBase& C) { arma_extra_debug_sigprint(); SpMat out; spglue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline SpMat join_vert(const SpBase& A, const SpBase& B, const SpBase& C, const SpBase& D) { arma_extra_debug_sigprint(); SpMat out; spglue_join_cols::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused inline const SpGlue join_rows(const SpBase& A, const SpBase& B) { arma_extra_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template arma_warn_unused inline SpMat join_rows(const SpBase& A, const SpBase& B, const SpBase& C) { arma_extra_debug_sigprint(); SpMat out; spglue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline SpMat join_rows(const SpBase& A, const SpBase& B, const SpBase& C, const SpBase& D) { arma_extra_debug_sigprint(); SpMat out; spglue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } template arma_warn_unused inline const SpGlue join_horiz(const SpBase& A, const SpBase& B) { arma_extra_debug_sigprint(); return SpGlue(A.get_ref(), B.get_ref()); } template arma_warn_unused inline SpMat join_horiz(const SpBase& A, const SpBase& B, const SpBase& C) { arma_extra_debug_sigprint(); SpMat out; spglue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref()); return out; } template arma_warn_unused inline SpMat join_horiz(const SpBase& A, const SpBase& B, const SpBase& C, const SpBase& D) { arma_extra_debug_sigprint(); SpMat out; spglue_join_rows::apply(out, A.get_ref(), B.get_ref(), C.get_ref(), D.get_ref()); return out; } //! @}