//------------------------------------------------------------------------------
// GxB_Matrix_pack_FullR: pack a matrix in full format, held by row
//------------------------------------------------------------------------------

// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2025, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//------------------------------------------------------------------------------

// The input array Ax is assumed to be in the data arena
// defined by the current Context, or the global context if no Context is
// engaged.  Results are undefined if this array is in a different arena.

// The output matrix A is created in the same data arena.
// The header for A remains unchanged and it stays in its same arena.

#include "import_export/GB_export.h"

GrB_Info GxB_Matrix_pack_FullR  // pack a full matrix, held by row
(
    GrB_Matrix A,       // matrix to create (type, nrows, ncols unchanged)
    void **Ax,          // values, Ax_memsize >= nrows*ncols * (type size)
                        // or Ax_memsize >= (type size), if iso is true
    uint64_t Ax_memsize,   // size of Ax in bytes
    bool iso,           // if true, A is iso
    const GrB_Descriptor desc
)
{ 

    //--------------------------------------------------------------------------
    // check inputs and get the descriptor
    //--------------------------------------------------------------------------

    GB_RETURN_IF_NULL (A) ;
    GB_RETURN_IF_OUTPUT_IS_READONLY (A) ;
    GB_WHERE_1 (A, "GxB_Matrix_pack_FullR (A, &Ax, Ax_memsize, iso, desc)") ;
    GB_BURBLE_START ("GxB_Matrix_pack_FullR") ;

    GB_GET_DESCRIPTOR (info, desc, xx1, xx2, xx3, xx4, xx5, xx6, xx7) ;
    GB_GET_DESCRIPTOR_IMPORT (desc, fast_import) ;

    //--------------------------------------------------------------------------
    // pack the matrix
    //--------------------------------------------------------------------------

    info = GB_import (true, &A, A->type, GB_NCOLS (A), GB_NROWS (A), false,
        NULL, 0,        // Ap
        NULL, 0,        // Ah
        NULL, 0,        // Ab
        NULL, 0,        // Ai
        Ax,   Ax_memsize,  // Ax
        0, false, 0,
        GxB_FULL, false,                    // full by row
        iso, fast_import, true, Werk) ;

    GB_BURBLE_END ;
    return (info) ;
}

