Defined a new level-1d operation: shiftd.

Details:
- Defined a new level-1d operation called 'shiftd', including object and
  typed APIs. This operation adds a scalar value to every element along
  an arbitrary diagonal of a matrix. Currently, shiftd is implemented in
  terms of the addv kernel. (The scalar is passed in as the x vector
  with an increment of zero.)
- Replaced ad-hoc usage of setd and addd (after creating a temporary
  matrix object) with use of shiftd, which is much more concise, in
  various test driver files in the testsuite. Similar changes were made
  to the standalone test drivers and the example code.
- Added documentation entries in BLISObjectAPI.md and BLISTypedAPI.md
  for bli_shiftd() and bli_?shiftd(), respectively.
- Added observed object properties to level-1d documentation in
  BLISObjectAPI.md.
This commit is contained in:
Field G. Van Zee
2018-10-18 17:11:39 -05:00
parent ec67679990
commit bb6df2814f
20 changed files with 267 additions and 53 deletions

View File

@@ -41,7 +41,7 @@ int main( int argc, char** argv )
dim_t m, n;
inc_t rs, cs;
obj_t a, x, y, b, d;
obj_t a, x, y, b;
obj_t* alpha;
obj_t* beta;
@@ -297,9 +297,7 @@ int main( int argc, char** argv )
// Load the diagonal. By setting the diagonal to something of greater
// absolute value than the off-diagonal elements, we increase the odds
// that the matrix is not singular (singular matrices have no inverse).
bli_obj_create( dt, m, m, 0, 0, &d );
bli_setd( &BLIS_TWO, &d );
bli_addd( &d, &a );
bli_shiftd( &BLIS_TWO, &a );
bli_printm( "a: randomized (zeros in upper triangle)", &a, "%4.1f", "" );
bli_printm( "b: initial value", &b, "%4.1f", "" );
@@ -320,7 +318,6 @@ int main( int argc, char** argv )
// Free the objects.
bli_obj_free( &a );
bli_obj_free( &b );
bli_obj_free( &d );
return 0;

View File

@@ -42,7 +42,7 @@ int main( int argc, char** argv )
inc_t rs, cs;
side_t side;
obj_t a, b, c, d;
obj_t a, b, c;
obj_t* alpha;
obj_t* beta;
@@ -299,9 +299,7 @@ int main( int argc, char** argv )
// Load the diagonal. By setting the diagonal to something of greater
// absolute value than the off-diagonal elements, we increase the odds
// that the matrix is not singular (singular matrices have no inverse).
bli_obj_create( dt, m, m, 0, 0, &d );
bli_setd( &BLIS_TWO, &d );
bli_addd( &d, &a );
bli_shiftd( &BLIS_TWO, &a );
bli_printm( "a: randomized (zeros in upper triangle)", &a, "%4.1f", "" );
bli_printm( "b: initial value", &b, "%4.1f", "" );
@@ -323,7 +321,6 @@ int main( int argc, char** argv )
bli_obj_free( &a );
bli_obj_free( &b );
bli_obj_free( &c );
bli_obj_free( &d );
return 0;

View File

@@ -41,7 +41,6 @@ int main( int argc, char** argv )
double* x;
double* y;
double* b;
double* d;
double alpha, beta;
dim_t m, n;
inc_t rs, cs;
@@ -286,10 +285,7 @@ int main( int argc, char** argv )
// Load the diagonal. By setting the diagonal to something of greater
// absolute value than the off-diagonal elements, we increase the odds
// that the matrix is not singular (singular matrices have no inverse).
d = malloc( m * m * sizeof( double ) );
bli_dsetd( BLIS_NO_CONJUGATE, 0, m, m, &two, d, 1, m );
bli_daddd( 0, BLIS_NONUNIT_DIAG, BLIS_NO_TRANSPOSE,
m, m, d, 1, m, a, rs, cs );
bli_dshiftd( 0, m, m, &two, a, rs, cs );
bli_dprintm( "a: randomized (zeros in upper triangle)", m, m, a, rs, cs, "%4.1f", "" );
bli_dprintm( "b: intial value", 1, m, b, m, 1, "%4.1f", "" );

View File

@@ -45,7 +45,6 @@ int main( int argc, char** argv )
double* a;
double* b;
double* c;
double* d;
double alpha, beta;
// Initialize some basic constants.
@@ -311,10 +310,7 @@ int main( int argc, char** argv )
// Load the diagonal. By setting the diagonal to something of greater
// absolute value than the off-diagonal elements, we increase the odds
// that the matrix is not singular (singular matrices have no inverse).
d = malloc( m * m * sizeof( double ) );
bli_dsetd( BLIS_NO_CONJUGATE, 0, m, m, &two, d, 1, m );
bli_daddd( 0, BLIS_NONUNIT_DIAG, BLIS_NO_TRANSPOSE,
m, m, d, 1, m, a, rsa, csa );
bli_dshiftd( 0, m, m, &two, a, rsa, csa );
bli_dprintm( "a: randomized (zeros in upper triangle)", m, m, a, rsa, csa, "%4.1f", "" );
bli_dprintm( "b: initial value", m, n, b, rsb, csb, "%4.1f", "" );
@@ -339,7 +335,6 @@ int main( int argc, char** argv )
free( a );
free( b );
free( c );
free( d );
return 0;