/**++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * * PANIC * Portable Algorithms and Numerics In C++ * * Scientific computing from scratch, with feeling. * * Copyright (c) 2026 Michelle Bausager * * This file is part of PANIC. * * PANIC is free software licensed under the GNU General Public License v3.0 or later. * You may redistribute and/or modify it under the terms of the GPL. * * PANIC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the LICENSE file for the full license text. * * SPDX-License-Identifier: GPL-3.0-or-later * *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * Project Name: PANIC * Module Name: tensor * File Name: one_hot.hpp * Revision: 0.1.0 * Date: 31-07-2026 * Author: Michelle Bausager * * Description: * Functions to one_hot matrices * *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ #pragma once #include #include // for panic::vector #include namespace panic{ namespace tensor{ /** * @brief Outputs an one_hot matrix * * Computes: * @code * @endcode * * @tparam T Numeric element type. * @param size Number of columns. * @param a Input vector that contains here 1 should be * @param B Output matrix * * @return true if @p B was resized and filled successfully. * @return false if resizing @p B failed. * * @note This overload writes the result into an existing vector to avoid * unnecessary temporary allocations. */ template bool one_hot(const panic::types::uint_t size, const panic::tensor::uint_vector& a, panic::tensor::matrix& B); /** * @brief Returns a one_hot matrix * * Computes: * @code * @endcode * * @param T Numeric element type. * @param size Number of columns. * @param a Input vector that contains here 1 should be * * @return A new vector containing the result. * @return An empty vector if the operation fails. * * @note This overload is convenient, but may allocate a new vector. */ //template //panic::tensor::matrix one_hot(const panic::types::uint_t size, const panic::tensor::vector& a); } // namespace tensor } // namespace panic