void libblis_test_setv_check( obj_t* beta, obj_t* x, double* resid ) { num_t dt_x = bli_obj_datatype( *x ); dim_t m_x = bli_obj_vector_dim( *x ); inc_t inc_x = bli_obj_vector_inc( *x ); void* buf_x = bli_obj_buffer_at_off( *x ); void* buf_beta = bli_obj_buffer_for_1x1( dt_x, *beta ); dim_t i; *resid = 0.0; // // The easiest way to check that setv was successful is to confirm // that each element of x is equal to beta. // if ( bli_obj_is_float( *x ) ) { float* chi1 = buf_x; float* beta_cast = buf_beta; for ( i = 0; i < m_x; ++i ) { if ( !bli_seq( *chi1, *beta_cast ) ) { *resid = 1.0; return; } chi1 += inc_x; } } else if ( bli_obj_is_double( *x ) ) { double* chi1 = buf_x; double* beta_cast = buf_beta; for ( i = 0; i < m_x; ++i ) { if ( !bli_deq( *chi1, *beta_cast ) ) { *resid = 1.0; return; } chi1 += inc_x; } } else if ( bli_obj_is_scomplex( *x ) ) { scomplex* chi1 = buf_x; scomplex* beta_cast = buf_beta; for ( i = 0; i < m_x; ++i ) { if ( !bli_ceq( *chi1, *beta_cast ) ) { *resid = 1.0; return; } chi1 += inc_x; } } else // if ( bli_obj_is_dcomplex( *x ) ) { dcomplex* chi1 = buf_x; dcomplex* beta_cast = buf_beta; for ( i = 0; i < m_x; ++i ) { if ( !bli_zeq( *chi1, *beta_cast ) ) { *resid = 1.0; return; } chi1 += inc_x; } } }
void libblis_test_setm_check ( test_params_t* params, obj_t* beta, obj_t* x, double* resid ) { num_t dt_x = bli_obj_datatype( *x ); dim_t m_x = bli_obj_length( *x ); dim_t n_x = bli_obj_width( *x ); inc_t rs_x = bli_obj_row_stride( *x ); inc_t cs_x = bli_obj_col_stride( *x ); void* buf_x = bli_obj_buffer_at_off( *x ); void* buf_beta = bli_obj_buffer_for_1x1( dt_x, *beta ); dim_t i, j; *resid = 0.0; // // The easiest way to check that setm was successful is to confirm // that each element of x is equal to beta. // if ( bli_obj_is_float( *x ) ) { float* beta_cast = buf_beta; float* buf_x_cast = buf_x; float* chi1; for ( j = 0; j < n_x; ++j ) { for ( i = 0; i < m_x; ++i ) { chi1 = buf_x_cast + (i )*rs_x + (j )*cs_x; if ( !bli_seq( *chi1, *beta_cast ) ) { *resid = 1.0; return; } } } } else if ( bli_obj_is_double( *x ) ) { double* beta_cast = buf_beta; double* buf_x_cast = buf_x; double* chi1; for ( j = 0; j < n_x; ++j ) { for ( i = 0; i < m_x; ++i ) { chi1 = buf_x_cast + (i )*rs_x + (j )*cs_x; if ( !bli_deq( *chi1, *beta_cast ) ) { *resid = 1.0; return; } } } } else if ( bli_obj_is_scomplex( *x ) ) { scomplex* beta_cast = buf_beta; scomplex* buf_x_cast = buf_x; scomplex* chi1; for ( j = 0; j < n_x; ++j ) { for ( i = 0; i < m_x; ++i ) { chi1 = buf_x_cast + (i )*rs_x + (j )*cs_x; if ( !bli_ceq( *chi1, *beta_cast ) ) { *resid = 1.0; return; } } } } else // if ( bli_obj_is_dcomplex( *x ) ) { dcomplex* beta_cast = buf_beta; dcomplex* buf_x_cast = buf_x; dcomplex* chi1; for ( j = 0; j < n_x; ++j ) { for ( i = 0; i < m_x; ++i ) { chi1 = buf_x_cast + (i )*rs_x + (j )*cs_x; if ( !bli_zeq( *chi1, *beta_cast ) ) { *resid = 1.0; return; } } } } }