Ejemplo n.º 1
0
void bli_trsv_basic_check( obj_t*  alpha,
                           obj_t*  a,
                           obj_t*  x )
{
	err_t e_val;

	// Check object datatypes.

	e_val = bli_check_noninteger_object( alpha );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( a );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( x );
	bli_check_error_code( e_val );

	// Check object dimensions.

	e_val = bli_check_scalar_object( alpha );
	bli_check_error_code( e_val );

	e_val = bli_check_square_object( a );
	bli_check_error_code( e_val );

	e_val = bli_check_vector_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_object_length_equals( a, bli_obj_vector_dim( *x ) );
	bli_check_error_code( e_val );
}
Ejemplo n.º 2
0
void bli_copysc_check( obj_t* chi,
                       obj_t* psi )
{
    err_t e_val;

    // Check object datatypes.

    e_val = bli_check_noninteger_object( chi );
    bli_check_error_code( e_val );

    e_val = bli_check_noninteger_object( psi );
    bli_check_error_code( e_val );

    e_val = bli_check_nonconstant_object( psi );
    bli_check_error_code( e_val );

    // Check object dimensions.

    e_val = bli_check_scalar_object( chi );
    bli_check_error_code( e_val );

    e_val = bli_check_scalar_object( psi );
    bli_check_error_code( e_val );

    // Check object buffers (for non-NULLness).

    e_val = bli_check_object_buffer( chi );
    bli_check_error_code( e_val );

    e_val = bli_check_object_buffer( psi );
    bli_check_error_code( e_val );
}
Ejemplo n.º 3
0
void bli_addd_check( obj_t*  x,
                     obj_t*  y )
{
	err_t e_val;

	// Check object datatypes.

	e_val = bli_check_floating_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( y );
	bli_check_error_code( e_val );

	// Check object dimensions.

	e_val = bli_check_matrix_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_matrix_object( y );
	bli_check_error_code( e_val );

	e_val = bli_check_conformal_dims( x, y );
	bli_check_error_code( e_val );

	// Check object buffers (for non-NULLness).

	e_val = bli_check_object_buffer( x );
	bli_check_error_code( e_val );

	e_val = bli_check_object_buffer( y );
	bli_check_error_code( e_val );
}
Ejemplo n.º 4
0
void bli_addv_check( obj_t*  x,
                     obj_t*  y )
{
	err_t e_val;

	// Check object datatypes.

	e_val = bli_check_floating_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( y );
	bli_check_error_code( e_val );

	// Check object dimensions.

	e_val = bli_check_vector_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_vector_object( y );
	bli_check_error_code( e_val );

	e_val = bli_check_equal_vector_lengths( x, y );
	bli_check_error_code( e_val );

	// Check object buffers (for non-NULLness).

	e_val = bli_check_object_buffer( x );
	bli_check_error_code( e_val );

	e_val = bli_check_object_buffer( y );
	bli_check_error_code( e_val );
}
Ejemplo n.º 5
0
void bli_utilv_xi_check
     (
       obj_t*  x,
       obj_t*  index
     )
{
	err_t e_val;

	// Check object datatypes.

	e_val = bli_check_floating_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_integer_object( index );
	bli_check_error_code( e_val );

	e_val = bli_check_nonconstant_object( index );
	bli_check_error_code( e_val );

	// Check object dimensions.

	e_val = bli_check_vector_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_scalar_object( index );
	bli_check_error_code( e_val );

	// Check object buffers (for non-NULLness).

	e_val = bli_check_object_buffer( x );
	bli_check_error_code( e_val );

	e_val = bli_check_object_buffer( index );
	bli_check_error_code( e_val );
}
Ejemplo n.º 6
0
void bli_utilm_norm_check
     (
       obj_t*  x,
       obj_t*  norm
     )
{
	err_t e_val;

	// Check object datatypes.

	e_val = bli_check_floating_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_noninteger_object( norm );
	bli_check_error_code( e_val );

	e_val = bli_check_nonconstant_object( norm );
	bli_check_error_code( e_val );

	// Check object dimensions.

	e_val = bli_check_matrix_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_scalar_object( norm );
	bli_check_error_code( e_val );

	// Check object buffers (for non-NULLness).

	e_val = bli_check_object_buffer( x );
	bli_check_error_code( e_val );

	e_val = bli_check_object_buffer( norm );
	bli_check_error_code( e_val );
}
Ejemplo n.º 7
0
void bli_param_map_blis_to_char_side( side_t blis_side, char* side )
{
    if      ( blis_side == BLIS_LEFT  ) *side = 'l';
    else if ( blis_side == BLIS_RIGHT ) *side = 'r';
    else
    {
        bli_check_error_code( BLIS_INVALID_SIDE );
    }
}
Ejemplo n.º 8
0
void bli_param_map_char_to_blis_diag( char diag, diag_t* blis_diag )
{
    if      ( diag == 'n' || diag == 'N' ) *blis_diag = BLIS_NONUNIT_DIAG;
    else if ( diag == 'u' || diag == 'U' ) *blis_diag = BLIS_UNIT_DIAG;
    else
    {
        bli_check_error_code( BLIS_INVALID_DIAG );
    }
}
Ejemplo n.º 9
0
void bli_param_map_char_to_blis_conj( char conj, conj_t* blis_conj )
{
    if      ( conj == 'n' || conj == 'N' ) *blis_conj = BLIS_NO_CONJUGATE;
    else if ( conj == 'c' || conj == 'C' ) *blis_conj = BLIS_CONJUGATE;
    else
    {
        bli_check_error_code( BLIS_INVALID_CONJ );
    }
}
Ejemplo n.º 10
0
void bli_param_map_blis_to_netlib_uplo( uplo_t uplo, char* blas_uplo )
{
    if      ( uplo == BLIS_LOWER ) *blas_uplo = 'L';
    else if ( uplo == BLIS_UPPER ) *blas_uplo = 'U';
    else
    {
        bli_check_error_code( BLIS_INVALID_UPLO );
    }
}
Ejemplo n.º 11
0
void bli_param_map_blis_to_netlib_diag( diag_t diag, char* blas_diag )
{
    if      ( diag == BLIS_NONUNIT_DIAG ) *blas_diag = 'N';
    else if ( diag == BLIS_UNIT_DIAG    ) *blas_diag = 'U';
    else
    {
        bli_check_error_code( BLIS_INVALID_DIAG );
    }
}
Ejemplo n.º 12
0
void bli_param_map_blis_to_char_diag( diag_t blis_diag, char* diag )
{
    if      ( blis_diag == BLIS_NONUNIT_DIAG ) *diag = 'n';
    else if ( blis_diag == BLIS_UNIT_DIAG    ) *diag = 'u';
    else
    {
        bli_check_error_code( BLIS_INVALID_DIAG );
    }
}
Ejemplo n.º 13
0
void bli_obj_create_check( num_t  dt,
                           dim_t  m,
                           dim_t  n,
                           inc_t  rs,
                           inc_t  cs,
                           obj_t* obj )
{
	err_t e_val;

	e_val = bli_check_valid_datatype( dt );
	bli_check_error_code( e_val );

	e_val = bli_check_matrix_strides( m, n, rs, cs );
	bli_check_error_code( e_val );

	e_val = bli_check_null_pointer( obj );
	bli_check_error_code( e_val );
}
Ejemplo n.º 14
0
void bli_obj_attach_buffer_check( void*  p,
                                  inc_t  rs,
                                  inc_t  cs,
                                  obj_t* obj )
{
	err_t e_val;

	e_val = bli_check_null_pointer( p );
	bli_check_error_code( e_val );

	e_val = bli_check_matrix_strides( bli_obj_length( *obj ),
	                                  bli_obj_width( *obj ),
	                                  rs, cs );
	bli_check_error_code( e_val );

	e_val = bli_check_null_pointer( obj );
	bli_check_error_code( e_val );
}
Ejemplo n.º 15
0
void bli_param_map_blis_to_netlib_side( side_t side, char* blas_side )
{
    if      ( side == BLIS_LEFT  ) *blas_side = 'L';
    else if ( side == BLIS_RIGHT ) *blas_side = 'R';
    else
    {
        bli_check_error_code( BLIS_INVALID_SIDE );
    }
}
Ejemplo n.º 16
0
void bli_param_map_char_to_blis_side( char side, side_t* blis_side )
{
    if      ( side == 'l' || side == 'L' ) *blis_side = BLIS_LEFT;
    else if ( side == 'r' || side == 'R' ) *blis_side = BLIS_RIGHT;
    else
    {
        bli_check_error_code( BLIS_INVALID_SIDE );
    }
}
Ejemplo n.º 17
0
void bli_param_map_blis_to_char_conj( conj_t blis_conj, char* conj )
{
    if      ( blis_conj == BLIS_NO_CONJUGATE ) *conj = 'n';
    else if ( blis_conj == BLIS_CONJUGATE    ) *conj = 'c';
    else
    {
        bli_check_error_code( BLIS_INVALID_CONJ );
    }
}
Ejemplo n.º 18
0
void bli_param_map_blis_to_char_uplo( uplo_t blis_uplo, char* uplo )
{
    if      ( blis_uplo == BLIS_LOWER ) *uplo = 'l';
    else if ( blis_uplo == BLIS_UPPER ) *uplo = 'u';
    else
    {
        bli_check_error_code( BLIS_INVALID_UPLO );
    }
}
Ejemplo n.º 19
0
void bli_herk_basic_check( obj_t*  alpha,
                           obj_t*  a,
                           obj_t*  ah,
                           obj_t*  beta,
                           obj_t*  c )
{
	err_t e_val;

	// Check object datatypes.

	e_val = bli_check_noninteger_object( alpha );
	bli_check_error_code( e_val );

	e_val = bli_check_noninteger_object( beta );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( a );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( ah );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( c );
	bli_check_error_code( e_val );

	// Check object dimensions.

	e_val = bli_check_scalar_object( alpha );
	bli_check_error_code( e_val );

	e_val = bli_check_scalar_object( beta );
	bli_check_error_code( e_val );

	e_val = bli_check_level3_dims( a, ah, c );
	bli_check_error_code( e_val );

	// Check matrix structure.

	e_val = bli_check_general_object( a );
	bli_check_error_code( e_val );

	e_val = bli_check_general_object( ah );
	bli_check_error_code( e_val );
}
Ejemplo n.º 20
0
void bli_param_map_char_to_blis_uplo( char uplo, uplo_t* blis_uplo )
{
    if      ( uplo == 'l' || uplo == 'L' ) *blis_uplo = BLIS_LOWER;
    else if ( uplo == 'u' || uplo == 'U' ) *blis_uplo = BLIS_UPPER;
    else if ( uplo == 'e' || uplo == 'E' ) *blis_uplo = BLIS_DENSE;
    else
    {
        bli_check_error_code( BLIS_INVALID_UPLO );
    }
}
Ejemplo n.º 21
0
void bli_param_map_blis_to_netlib_trans( trans_t trans, char* blas_trans )
{
    if      ( trans == BLIS_NO_TRANSPOSE   ) *blas_trans = 'N';
    else if ( trans == BLIS_TRANSPOSE      ) *blas_trans = 'T';
    else if ( trans == BLIS_CONJ_TRANSPOSE ) *blas_trans = 'C';
    else
    {
        bli_check_error_code( BLIS_INVALID_TRANS );
    }
}
Ejemplo n.º 22
0
void bli_utilm_rand_check
     (
       obj_t* x
     )
{
	err_t e_val;

	// Check object datatypes.

	e_val = bli_check_noninteger_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_nonconstant_object( x );
	bli_check_error_code( e_val );

	// Check object buffers (for non-NULLness).

	e_val = bli_check_object_buffer( x );
	bli_check_error_code( e_val );
}
Ejemplo n.º 23
0
void bli_gemm_check( obj_t*  alpha,
                     obj_t*  a,
                     obj_t*  b,
                     obj_t*  beta,
                     obj_t*  c )
{
	err_t e_val;

	// Check basic properties of the operation.

	bli_gemm_basic_check( alpha, a, b, beta, c );

	// Check matrix structure.

	e_val = bli_check_general_object( a );
	bli_check_error_code( e_val );

	e_val = bli_check_general_object( b );
	bli_check_error_code( e_val );
}
Ejemplo n.º 24
0
dim_t bli_packm_offset_to_panel_for( dim_t offmn, obj_t* p )
{
	dim_t panel_off;

	if      ( bli_obj_pack_schema( *p ) == BLIS_PACKED_ROWS )
	{
		// For the "packed rows" schema, a single row is effectively one
		// row panel, and so we use the row offset as the panel offset.
		// Then we multiply this offset by the effective panel stride
		// (ie: the row stride) to arrive at the desired offset.
		panel_off = offmn * bli_obj_row_stride( *p );
	}
	else if ( bli_obj_pack_schema( *p ) == BLIS_PACKED_COLUMNS )
	{
		// For the "packed columns" schema, a single column is effectively one
		// column panel, and so we use the column offset as the panel offset.
		// Then we multiply this offset by the effective panel stride
		// (ie: the column stride) to arrive at the desired offset.
		panel_off = offmn * bli_obj_col_stride( *p );
	}
	else if ( bli_obj_pack_schema( *p ) == BLIS_PACKED_ROW_PANELS )
	{
		// For the "packed row panels" schema, the column stride is equal to
		// the panel dimension (length). So we can divide it into offmn
		// (interpreted as a row offset) to arrive at a panel offset. Then
		// we multiply this offset by the panel stride to arrive at the total
		// offset to the panel (in units of elements).
		panel_off = offmn / bli_obj_col_stride( *p );
		panel_off = panel_off * bli_obj_panel_stride( *p );

		// Sanity check.
		if ( offmn % bli_obj_col_stride( *p ) > 0 ) bli_abort();
	}
	else if ( bli_obj_pack_schema( *p ) == BLIS_PACKED_COL_PANELS )
	{
		// For the "packed column panels" schema, the row stride is equal to
		// the panel dimension (width). So we can divide it into offmn
		// (interpreted as a column offset) to arrive at a panel offset. Then
		// we multiply this offset by the panel stride to arrive at the total
		// offset to the panel (in units of elements).
		panel_off = offmn / bli_obj_row_stride( *p );
		panel_off = panel_off * bli_obj_panel_stride( *p );

		// Sanity check.
		if ( offmn % bli_obj_row_stride( *p ) > 0 ) bli_abort();
	}
	else
	{
		panel_off = 0;
		bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED );
	}

	return panel_off;
}
Ejemplo n.º 25
0
void bli_param_map_char_to_blis_trans( char trans, trans_t* blis_trans )
{
    if      ( trans == 'n' || trans == 'N' ) *blis_trans = BLIS_NO_TRANSPOSE;
    else if ( trans == 't' || trans == 'T' ) *blis_trans = BLIS_TRANSPOSE;
    else if ( trans == 'c' || trans == 'C' ) *blis_trans = BLIS_CONJ_NO_TRANSPOSE;
    else if ( trans == 'h' || trans == 'H' ) *blis_trans = BLIS_CONJ_TRANSPOSE;
    else
    {
        bli_check_error_code( BLIS_INVALID_TRANS );
    }
}
Ejemplo n.º 26
0
void bli_param_map_blis_to_char_trans( trans_t blis_trans, char* trans )
{
    if      ( blis_trans == BLIS_NO_TRANSPOSE      ) *trans = 'n';
    else if ( blis_trans == BLIS_TRANSPOSE         ) *trans = 't';
    else if ( blis_trans == BLIS_CONJ_NO_TRANSPOSE ) *trans = 'c';
    else if ( blis_trans == BLIS_CONJ_TRANSPOSE    ) *trans = 'h';
    else
    {
        bli_check_error_code( BLIS_INVALID_TRANS );
    }
}
Ejemplo n.º 27
0
void bli_ger_basic_check( obj_t*  alpha,
                          obj_t*  x,
                          obj_t*  y,
                          obj_t*  a )
{
	err_t e_val;

	// Check object datatypes.

	e_val = bli_check_noninteger_object( alpha );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( y );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( a );
	bli_check_error_code( e_val );

	// Check object dimensions.

	e_val = bli_check_scalar_object( alpha );
	bli_check_error_code( e_val );

	e_val = bli_check_vector_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_vector_object( y );
	bli_check_error_code( e_val );

	e_val = bli_check_matrix_object( a );
	bli_check_error_code( e_val );

	e_val = bli_check_vector_dim_equals( x, bli_obj_length_after_trans( *a ) );
	bli_check_error_code( e_val );

	e_val = bli_check_vector_dim_equals( y, bli_obj_width_after_trans( *a ) );
	bli_check_error_code( e_val );
}
Ejemplo n.º 28
0
void bli_obj_create_const_copy_of( obj_t* a, obj_t* b )
{
	gint_t*   temp_i;
	float*    temp_s;
	double*   temp_d;
	scomplex* temp_c;
	dcomplex* temp_z;
	void*     buf_a;
	dcomplex  value;

	if ( bli_error_checking_is_enabled() )
		bli_obj_create_const_copy_of_check( a, b );

	bli_obj_create( BLIS_CONSTANT, 1, 1, 1, 1, b );

	temp_s = bli_obj_buffer_for_const( BLIS_FLOAT,    *b );
	temp_d = bli_obj_buffer_for_const( BLIS_DOUBLE,   *b );
	temp_c = bli_obj_buffer_for_const( BLIS_SCOMPLEX, *b );
	temp_z = bli_obj_buffer_for_const( BLIS_DCOMPLEX, *b );
	temp_i = bli_obj_buffer_for_const( BLIS_INT,      *b );

	buf_a = bli_obj_buffer_at_off( *a );

	bli_zzsets( 0.0, 0.0, value ); 

	if ( bli_obj_is_float( *a ) )
	{
		bli_szcopys( *(( float*    )buf_a), value );
	}
	else if ( bli_obj_is_double( *a ) )
	{
		bli_dzcopys( *(( double*   )buf_a), value );
	}
	else if ( bli_obj_is_scomplex( *a ) )
	{
		bli_czcopys( *(( scomplex* )buf_a), value );
	}
	else if ( bli_obj_is_dcomplex( *a ) )
	{
		bli_zzcopys( *(( dcomplex* )buf_a), value );
	}
	else
	{
		bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED );
	}

	bli_zscopys( value, *temp_s );
	bli_zdcopys( value, *temp_d );
	bli_zccopys( value, *temp_c );
	bli_zzcopys( value, *temp_z );

	*temp_i = ( gint_t ) bli_zreal( value );
}
Ejemplo n.º 29
0
void bli_absumm_check( obj_t*  x,
                       obj_t*  absum )
{
	err_t e_val;

	// Check object datatypes.

	e_val = bli_check_floating_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_nonconstant_object( absum );
	bli_check_error_code( e_val );

	// Check object dimensions.

	e_val = bli_check_matrix_object( x );
	bli_check_error_code( e_val );

	e_val = bli_check_scalar_object( absum );
	bli_check_error_code( e_val );
}
Ejemplo n.º 30
0
void bli_setd_check( obj_t*  beta,
                     obj_t*  x )
{
	err_t e_val;

	// Check object datatypes.

	e_val = bli_check_noninteger_object( beta );
	bli_check_error_code( e_val );

	e_val = bli_check_floating_object( x );
	bli_check_error_code( e_val );

	// Check object dimensions.

	e_val = bli_check_scalar_object( beta );
	bli_check_error_code( e_val );

	e_val = bli_check_matrix_object( x );
	bli_check_error_code( e_val );
}