libflame  revision_anchor
Functions
FLA_CAQR_UT_inc_compute_p_length.c File Reference

(r)

Functions

dim_t FLA_CAQR_UT_inc_compute_blocks_per_part (dim_t p, FLA_Obj A)

Function Documentation

References FLA_Obj_length().

Referenced by FLASH_Apply_CAQ_UT_inc(), FLASH_CAQR_UT_inc_create_hier_matrices(), and FLASH_CAQR_UT_inc_noopt().

{
    dim_t nb_part;
    dim_t nb_left;
    dim_t num_blocks;

    // Query the element (not scalar) length of A.
    num_blocks = FLA_Obj_length( A );
    
    // Compute the number of blocks per partitions.
    nb_part = num_blocks / p;
    nb_left = num_blocks % p;

    // If there are leftover blocks, increase nb_part by one.
    if ( nb_left > 0 ) nb_part += 1;

    return nb_part;
}