FLA_Error FLA_Obj_create_buffer_check( dim_t rs, dim_t cs, FLA_Obj *obj ) { FLA_Error e_val; e_val = FLA_Check_null_pointer( obj ); FLA_Check_error_code( e_val ); e_val = FLA_Check_matrix_strides( FLA_Obj_length( *obj ), FLA_Obj_width( *obj ), rs, cs ); FLA_Check_error_code( e_val ); return FLA_SUCCESS; }
FLA_Error FLA_Axpy_buffer_to_object_check( FLA_Trans trans, FLA_Obj alpha, dim_t m, dim_t n, void* A_buffer, dim_t rs, dim_t cs, dim_t i, dim_t j, FLA_Obj B ) { FLA_Error e_val; e_val = FLA_Check_valid_real_trans( trans ); FLA_Check_error_code( e_val ); e_val = FLA_Check_floating_object( B ); FLA_Check_error_code( e_val ); e_val = FLA_Check_nonconstant_object( B ); FLA_Check_error_code( e_val ); e_val = FLA_Check_consistent_object_datatype( B, alpha ); FLA_Check_error_code( e_val ); e_val = FLA_Check_if_scalar( alpha ); FLA_Check_error_code( e_val ); e_val = FLA_Check_null_pointer( A_buffer ); FLA_Check_error_code( e_val ); e_val = FLA_Check_object_dims( trans, m, n, B ); FLA_Check_error_code( e_val ); e_val = FLA_Check_matrix_strides( m, n, rs, cs ); FLA_Check_error_code( e_val ); if ( trans == FLA_NO_TRANSPOSE ) { e_val = FLA_Check_submatrix_dims_and_offset( m, n, i, j, B ); FLA_Check_error_code( e_val ); } else { e_val = FLA_Check_submatrix_dims_and_offset( n, m, i, j, B ); FLA_Check_error_code( e_val ); } e_val = FLA_Check_nonconstant_object( B ); FLA_Check_error_code( e_val ); return FLA_SUCCESS; }
FLA_Error FLA_Copy_object_to_buffer_check( FLA_Trans trans, dim_t i, dim_t j, FLA_Obj A, dim_t m, dim_t n, void* B_buffer, dim_t rs, dim_t cs ) { FLA_Error e_val; e_val = FLA_Check_valid_real_trans( trans ); FLA_Check_error_code( e_val ); e_val = FLA_Check_floating_object( A ); FLA_Check_error_code( e_val ); e_val = FLA_Check_nonconstant_object( A ); FLA_Check_error_code( e_val ); e_val = FLA_Check_null_pointer( B_buffer ); FLA_Check_error_code( e_val ); e_val = FLA_Check_object_dims( trans, m, n, A ); FLA_Check_error_code( e_val ); e_val = FLA_Check_matrix_strides( m, n, rs, cs ); FLA_Check_error_code( e_val ); if ( trans == FLA_NO_TRANSPOSE ) { e_val = FLA_Check_submatrix_dims_and_offset( m, n, i, j, A ); FLA_Check_error_code( e_val ); } else { e_val = FLA_Check_submatrix_dims_and_offset( n, m, i, j, A ); FLA_Check_error_code( e_val ); } e_val = FLA_Check_nonconstant_object( A ); FLA_Check_error_code( e_val ); return FLA_SUCCESS; }
FLA_Error FLASH_Axpy_hier_to_buffer( FLA_Obj alpha, dim_t i, dim_t j, FLA_Obj H, dim_t m, dim_t n, void* buffer, dim_t rs, dim_t cs ) { FLA_Obj flat_matrix; FLA_Datatype datatype; FLA_Error e_val; if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING ) { e_val = FLA_Check_if_scalar( alpha ); FLA_Check_error_code( e_val ); e_val = FLA_Check_consistent_object_datatype( alpha, H ); FLA_Check_error_code( e_val ); e_val = FLA_Check_matrix_strides( m, n, rs, cs ); FLA_Check_error_code( e_val ); e_val = FLA_Check_submatrix_dims_and_offset( m, n, i, j, H ); FLA_Check_error_code( e_val ); } // Acquire the datatype from the hierarchical matrix object. datatype = FLASH_Obj_datatype( H ); // Create a temporary conventional matrix object of the requested datatype // and dimensions and attach the given buffer containing the incoming data. FLA_Obj_create_without_buffer( datatype, m, n, &flat_matrix ); FLA_Obj_attach_buffer( buffer, rs, cs, &flat_matrix ); // Recurse through H, adding in the corresponding elements of flat_matrix, // starting at the (i,j) element offset. FLASH_Axpy_hier_to_flat( alpha, i, j, H, flat_matrix ); // Free the object (but don't free the buffer!). FLA_Obj_free_without_buffer( &flat_matrix ); return FLA_SUCCESS; }