Separated expert, non-expert typed APIs.

Details:
- Split existing typed APIs into two subsets of interfaces: one for use
  with expert parameters, such as the cntx_t*, and one without. This
  separation was already in place for the object APIs, and after this
  commit the typed and object APIs will have similar expert and non-
  expert APIs. The expert functions will be suffixed with "_ex" just as
  is the case for expert interfaces in the object APIs.
- Updated internal invocations of typed APIs (functions such as
  bli_?setm() and bli_?scalv()) throughout BLIS to reflect use of the
  new explictly expert APIs.
- Updated example code in examples/tapi to reflect the existence (and
  usage) of non-expert APIs.
- Bumped the major soname version number in 'so_version'. While code
  compiled against a previous version/commit will likely still work
  (since the old typed function symbol names still exist in the new API,
  just with one less function argument) the semantics of the function
  have changed if the cntx_t* parameter the application passes in is
  non-NULL. For example, calling bli_daxpyv() with a non-NULL context
  does not behave the same way now as it did before; before, the
  context would be used in the computation, and now the context would
  be ignored since the interace for that function no longer expects a
  context argument.
This commit is contained in:
Field G. Van Zee
2018-07-06 19:14:02 -05:00
parent 331694e524
commit e88aedae73
128 changed files with 2006 additions and 818 deletions

View File

@@ -87,9 +87,9 @@ int main( int argc, char** argv )
printf( "gamma:\n%4.1f\n\n", gamma );
printf( "\n" );
bli_dsetv( BLIS_NO_CONJUGATE, n, &one, x, 1, NULL );
bli_dsetv( BLIS_NO_CONJUGATE, n, &alpha, y, 1, NULL );
bli_dsetv( BLIS_NO_CONJUGATE, n, &zero, z, 1, NULL );
bli_dsetv( BLIS_NO_CONJUGATE, n, &one, x, 1 );
bli_dsetv( BLIS_NO_CONJUGATE, n, &alpha, y, 1 );
bli_dsetv( BLIS_NO_CONJUGATE, n, &zero, z, 1 );
// Note that we can use printv or printm to print vectors since vectors
// are also matrices. We choose to use printm because it honors the
@@ -108,7 +108,7 @@ int main( int argc, char** argv )
printf( "\n#\n# -- Example 2 --\n#\n\n" );
// Set a vector to random values.
bli_drandv( n, w, 1, NULL );
bli_drandv( n, w, 1 );
bli_dprintm( "x := randv()", m, n, w, rs, cs, "%4.1f", "" );
@@ -120,37 +120,37 @@ int main( int argc, char** argv )
printf( "\n#\n# -- Example 3 --\n#\n\n" );
// Copy a vector.
bli_dcopyv( BLIS_NO_CONJUGATE, n, w, 1, a, 1, NULL );
bli_dcopyv( BLIS_NO_CONJUGATE, n, w, 1, a, 1 );
bli_dprintm( "a := w", m, n, a, rs, cs, "%4.1f", "" );
// Add and subtract vectors.
bli_daddv( BLIS_NO_CONJUGATE, n, y, 1, a, 1, NULL );
bli_daddv( BLIS_NO_CONJUGATE, n, y, 1, a, 1 );
bli_dprintm( "a := a + y", m, n, a, rs, cs, "%4.1f", "" );
bli_dsubv( BLIS_NO_CONJUGATE, n, w, 1, a, 1, NULL );
bli_dsubv( BLIS_NO_CONJUGATE, n, w, 1, a, 1 );
bli_dprintm( "a := a + w", m, n, a, rs, cs, "%4.1f", "" );
// Scale a vector (destructive).
bli_dscalv( BLIS_NO_CONJUGATE, n, &beta, a, 1, NULL );
bli_dscalv( BLIS_NO_CONJUGATE, n, &beta, a, 1 );
bli_dprintm( "a := beta * a", m, n, a, rs, cs, "%4.1f", "" );
// Scale a vector (non-destructive).
bli_dscal2v( BLIS_NO_CONJUGATE, n, &gamma, a, 1, z, 1, NULL );
bli_dscal2v( BLIS_NO_CONJUGATE, n, &gamma, a, 1, z, 1 );
bli_dprintm( "z := gamma * a", m, n, z, rs, cs, "%4.1f", "" );
// Scale and accumulate between vectors.
bli_daxpyv( BLIS_NO_CONJUGATE, n, &alpha, w, 1, x, 1, NULL );
bli_daxpyv( BLIS_NO_CONJUGATE, n, &alpha, w, 1, x, 1 );
bli_dprintm( "x := x + alpha * w", m, n, x, rs, cs, "%4.1f", "" );
bli_dxpbyv( BLIS_NO_CONJUGATE, n, w, 1, &minus_one, x, 1, NULL );
bli_dxpbyv( BLIS_NO_CONJUGATE, n, w, 1, &minus_one, x, 1 );
bli_dprintm( "x := -1.0 * x + w", m, n, x, rs, cs, "%4.1f", "" );
// Invert a vector element-wise.
bli_dinvertv( n, y, 1, NULL );
bli_dinvertv( n, y, 1 );
bli_dprintm( "y := 1 / y", m, n, y, rs, cs, "%4.1f", "" );
// Swap two vectors.
bli_dswapv( n, x, 1, y, 1, NULL );
bli_dswapv( n, x, 1, y, 1 );
bli_dprintm( "x (after swapping with y)", m, n, x, rs, cs, "%4.1f", "" );
bli_dprintm( "y (after swapping with x)", m, n, y, rs, cs, "%4.1f", "" );
@@ -162,11 +162,11 @@ int main( int argc, char** argv )
printf( "\n#\n# -- Example 4 --\n#\n\n" );
// Perform a dot product.
bli_ddotv( BLIS_NO_CONJUGATE, BLIS_NO_CONJUGATE, n, a, 1, z, 1, &gamma, NULL );
bli_ddotv( BLIS_NO_CONJUGATE, BLIS_NO_CONJUGATE, n, a, 1, z, 1, &gamma );
printf( "gamma := a * z (dot product):\n%5.2f\n\n", gamma );
// Perform an extended dot product.
bli_ddotxv( BLIS_NO_CONJUGATE, BLIS_NO_CONJUGATE, n, &alpha, a, 1, z, 1, &one, &gamma, NULL );
bli_ddotxv( BLIS_NO_CONJUGATE, BLIS_NO_CONJUGATE, n, &alpha, a, 1, z, 1, &one, &gamma );
printf( "gamma := 1.0 * gamma + alpha * a * z (accumulate scaled dot product):\n%5.2f\n\n", gamma );

View File

@@ -93,11 +93,11 @@ int main( int argc, char** argv )
// The diagonal offset is only used when the uplo value is something other
// than BLIS_DENSE (e.g. BLIS_LOWER or BLIS_UPPER).
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &one, a, rs, cs, NULL );
m, n, &one, a, rs, cs );
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &alpha, b, rs, cs, NULL );
m, n, &alpha, b, rs, cs );
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &zero, c, rs, cs, NULL );
m, n, &zero, c, rs, cs );
bli_dprintm( "a := 1.0", m, n, a, rs, cs, "%4.1f", "" );
bli_dprintm( "b := alpha", m, n, b, rs, cs, "%4.1f", "" );
@@ -110,7 +110,7 @@ int main( int argc, char** argv )
printf( "\n#\n# -- Example 2 --\n#\n\n" );
bli_drandm( 0, BLIS_DENSE, m, n, e, rs, cs, NULL );
bli_drandm( 0, BLIS_DENSE, m, n, e, rs, cs );
bli_dprintm( "e (randomized):", m, n, e, rs, cs, "%4.1f", "" );
@@ -123,31 +123,31 @@ int main( int argc, char** argv )
// Copy a matrix.
bli_dcopym( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE, BLIS_NO_TRANSPOSE,
m, n, e, rs, cs, d, rs, cs, NULL );
m, n, e, rs, cs, d, rs, cs );
bli_dprintm( "d := e", m, n, d, rs, cs, "%4.1f", "" );
// Add and subtract vectors.
bli_daddm( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE, BLIS_NO_TRANSPOSE,
m, n, a, rs, cs, d, rs, cs, NULL );
m, n, a, rs, cs, d, rs, cs );
bli_dprintm( "d := d + a", m, n, d, rs, cs, "%4.1f", "" );
bli_dsubm( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE, BLIS_NO_TRANSPOSE,
m, n, a, rs, cs, e, rs, cs, NULL );
m, n, a, rs, cs, e, rs, cs );
bli_dprintm( "e := e - a", m, n, e, rs, cs, "%4.1f", "" );
// Scale a matrix (destructive).
bli_dscalm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &alpha, e, rs, cs, NULL );
m, n, &alpha, e, rs, cs );
bli_dprintm( "e := alpha * e", m, n, e, rs, cs, "%4.1f", "" );
// Scale a matrix (non-destructive).
bli_dscal2m( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE, BLIS_NO_TRANSPOSE,
m, n, &beta, e, rs, cs, c, rs, cs, NULL );
m, n, &beta, e, rs, cs, c, rs, cs );
bli_dprintm( "c := beta * e", m, n, c, rs, cs, "%4.1f", "" );
// Scale and accumulate between matrices.
bli_daxpym( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE, BLIS_NO_TRANSPOSE,
m, n, &alpha, a, rs, cs, c, rs, cs, NULL );
m, n, &alpha, a, rs, cs, c, rs, cs );
bli_dprintm( "c := alpha * a", m, n, c, rs, cs, "%4.1f", "" );
@@ -164,7 +164,7 @@ int main( int argc, char** argv )
// Initialize all of 'f' to -1.0 to simulate junk values.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
n, m, &minus_one, f, rsf, csf, NULL );
n, m, &minus_one, f, rsf, csf );
bli_dprintm( "e:", m, n, e, rs, cs, "%4.1f", "" );
bli_dprintm( "f (initial value):", n, m, f, rsf, csf, "%4.1f", "" );
@@ -174,7 +174,7 @@ int main( int argc, char** argv )
// modified any properties of 'd'. It's the source operand that matters
// when marking an operand for transposition, not the destination.
bli_dcopym( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE, BLIS_TRANSPOSE,
n, m, e, rs, cs, f, rsf, csf, NULL );
n, m, e, rs, cs, f, rsf, csf );
bli_dprintm( "f (copied value):", n, m, f, rsf, csf, "%4.1f", "" );
@@ -188,16 +188,16 @@ int main( int argc, char** argv )
g = malloc( m * n * sizeof(dcomplex) );
h = malloc( n * m * sizeof(dcomplex) );
bli_zrandm( 0, BLIS_DENSE, m, n, g, rs, cs, NULL );
bli_zrandm( 0, BLIS_DENSE, m, n, g, rs, cs );
bli_zsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
n, m, &minus_one_z, h, rsf, csf, NULL );
n, m, &minus_one_z, h, rsf, csf );
bli_zprintm( "g:", m, n, g, rs, cs, "%4.1f", "" );
bli_zprintm( "h (initial value):", n, m, h, rsf, csf, "%4.1f", "" );
bli_zcopym( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE, BLIS_CONJ_TRANSPOSE,
n, m, g, rs, cs, h, rsf, csf, NULL );
n, m, g, rs, cs, h, rsf, csf );
bli_zprintm( "h (copied value):", n, m, h, rsf, csf, "%4.1f", "" );

View File

@@ -48,7 +48,6 @@ int main( int argc, char** argv )
// Initialize some basic constants.
double zero = 0.0;
double one = 1.0;
double minus_one = -1.0;
@@ -68,7 +67,7 @@ int main( int argc, char** argv )
a = malloc( m * n * sizeof( double ) );
// Set the upper triangle to random values.
bli_drandm( 0, BLIS_UPPER, m, n, a, rs, cs, NULL );
bli_drandm( 0, BLIS_UPPER, m, n, a, rs, cs );
bli_dprintm( "a: randomize upper part (lower part may contain garbage)",
m, n, a, rs, cs, "%4.1f", "" );
@@ -86,12 +85,12 @@ int main( int argc, char** argv )
b = malloc( m * n * sizeof( double ) );
// Set the upper triangle to random values.
bli_drandm( 0, BLIS_UPPER, m, n, b, rs, cs, NULL );
bli_drandm( 0, BLIS_UPPER, m, n, b, rs, cs );
// Set the strictly lower triangle of 'b' to zero (by setting the lower
// triangle of 'bl' to zero).
bli_dsetm( BLIS_NO_CONJUGATE, -1, BLIS_NONUNIT_DIAG, BLIS_LOWER,
m, n, &zero, b, rs, cs, NULL );
m, n, &zero, b, rs, cs );
bli_dprintm( "b: randomize upper part; set strictly lower part to 0.0)",
m, n, b, rs, cs, "%4.1f", "" );
@@ -100,7 +99,7 @@ int main( int argc, char** argv )
// since those values may already be zero (instead of random junk). So
// let's set it to something you'll notice, like -1.0.
bli_dsetm( BLIS_NO_CONJUGATE, -1, BLIS_NONUNIT_DIAG, BLIS_LOWER,
m, n, &minus_one, b, rs, cs, NULL );
m, n, &minus_one, b, rs, cs );
bli_dprintm( "b: randomize upper part; set strictly lower part to -1.0)",
m, n, b, rs, cs, "%4.1f", "" );
@@ -118,13 +117,13 @@ int main( int argc, char** argv )
c = malloc( m * n * sizeof( double ) );
bli_dcopym( 0, BLIS_NONUNIT_DIAG, BLIS_LOWER, BLIS_NO_TRANSPOSE,
m, n, b, rs, cs, c, rs, cs, NULL );
m, n, b, rs, cs, c, rs, cs );
bli_dprintm( "c: copy lower part of b (upper part may contain garbage)",
m, n, c, rs, cs, "%4.1f", "" );
bli_dcopym( 0, BLIS_NONUNIT_DIAG, BLIS_LOWER, BLIS_NO_TRANSPOSE,
m, n, b, rs, cs, a, rs, cs, NULL );
m, n, b, rs, cs, a, rs, cs );
bli_dprintm( "a: copy lower triangle of b to upper triangular a",
m, n, a, rs, cs, "%4.1f", "" );
@@ -143,7 +142,7 @@ int main( int argc, char** argv )
// Let's start by setting entire destination matrix to zero.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &zero, d, rs, cs, NULL );
m, n, &zero, d, rs, cs );
bli_dprintm( "d: initial value (all zeros)",
m, n, d, rs, cs, "%4.1f", "" );
@@ -160,7 +159,7 @@ int main( int argc, char** argv )
m, n, b, rs, cs, "%4.1f", "" );
bli_dcopym( 0, BLIS_NONUNIT_DIAG, BLIS_LOWER, BLIS_TRANSPOSE,
m, n, b, rs, cs, d, rs, cs, NULL );
m, n, b, rs, cs, d, rs, cs );
bli_dprintm( "d: transpose of lower triangle of b copied to d",
m, n, d, rs, cs, "%4.1f", "" );
@@ -180,20 +179,20 @@ int main( int argc, char** argv )
// Initialize the entire matrix to -1.0 to simulate junk values.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &minus_one, e, rs, cs, NULL );
m, n, &minus_one, e, rs, cs );
bli_dprintm( "e: initial value (all -1.0)",
m, n, e, rs, cs, "%4.1f", "" );
// Randomize the lower trapezoid.
bli_drandm( 0, BLIS_LOWER, m, n, e, rs, cs, NULL );
bli_drandm( 0, BLIS_LOWER, m, n, e, rs, cs );
bli_dprintm( "e: after lower trapezoid randomized",
m, n, e, rs, cs, "%4.1f", "" );
// Set the upper triangle to zero.
bli_dsetm( BLIS_NO_CONJUGATE, 1, BLIS_NONUNIT_DIAG, BLIS_UPPER,
m, n, &zero, e, rs, cs, NULL );
m, n, &zero, e, rs, cs );
bli_dprintm( "e: after upper triangle set to zero",
m, n, e, rs, cs, "%4.1f", "" );
@@ -212,13 +211,13 @@ int main( int argc, char** argv )
// Initialize the entire matrix to -1.0 to simulate junk values.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &minus_one, h, rs, cs, NULL );
m, n, &minus_one, h, rs, cs );
bli_dprintm( "h: initial value (all -1.0)",
m, n, h, rs, cs, "%4.1f", "" );
// Randomize the elements on and above the first subdiagonal.
bli_drandm( -1, BLIS_UPPER, m, n, h, rs, cs, NULL );
bli_drandm( -1, BLIS_UPPER, m, n, h, rs, cs );
bli_dprintm( "h: after randomizing above first subdiagonal",
m, n, h, rs, cs, "%4.1f", "" );
@@ -226,7 +225,7 @@ int main( int argc, char** argv )
// Set the region strictly below the first subdiagonal (on or below
// the second subdiagonal) to zero.
bli_dsetm( BLIS_NO_CONJUGATE, -2, BLIS_NONUNIT_DIAG, BLIS_LOWER,
m, n, &zero, h, rs, cs, NULL );
m, n, &zero, h, rs, cs );
bli_dprintm( "h: after setting elements below first subdiagonal to zero",
m, n, h, rs, cs, "%4.1f", "" );

View File

@@ -74,12 +74,12 @@ int main( int argc, char** argv )
alpha = 1.0;
// Initialize vectors 'x' and 'y'.
bli_drandv( m, x, 1, NULL );
bli_dsetv( BLIS_NO_CONJUGATE, n, &minus_one, y, 1, NULL );
bli_drandv( m, x, 1 );
bli_dsetv( BLIS_NO_CONJUGATE, n, &minus_one, y, 1 );
// Initialize 'a' to 1.0.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &one, a, rs, cs, NULL );
m, n, &one, a, rs, cs );
bli_dprintm( "x: set to random values", m, 1, x, 1, m, "%4.1f", "" );
bli_dprintm( "y: set to -1.0", 1, n, y, n, 1, "%4.1f", "" );
@@ -87,7 +87,7 @@ int main( int argc, char** argv )
// a := a + alpha * x * y, where 'a' is general.
bli_dger( BLIS_NO_CONJUGATE, BLIS_NO_CONJUGATE,
m, n, &alpha, x, 1, y, 1, a, rs, cs, NULL );
m, n, &alpha, x, 1, y, 1, a, rs, cs );
bli_dprintm( "a: after ger", m, n, a, rs, cs, "%4.1f", "" );
@@ -114,11 +114,11 @@ int main( int argc, char** argv )
beta = 1.0;
// Initialize vectors 'x' and 'y'.
bli_dsetv( BLIS_NO_CONJUGATE, n, &one, x, 1, NULL );
bli_dsetv( BLIS_NO_CONJUGATE, m, &zero, y, 1, NULL );
bli_dsetv( BLIS_NO_CONJUGATE, n, &one, x, 1 );
bli_dsetv( BLIS_NO_CONJUGATE, m, &zero, y, 1 );
// Randomize 'a'.
bli_drandm( 0, BLIS_DENSE, m, n, a, rs, cs, NULL );
bli_drandm( 0, BLIS_DENSE, m, n, a, rs, cs );
bli_dprintm( "a: randomized", m, n, a, rs, cs, "%4.1f", "" );
bli_dprintm( "x: set to 1.0", 1, n, x, n, 1, "%4.1f", "" );
@@ -126,7 +126,7 @@ int main( int argc, char** argv )
// y := beta * y + alpha * a * x, where 'a' is general.
bli_dgemv( BLIS_NO_TRANSPOSE, BLIS_NO_CONJUGATE,
m, n, &alpha, a, rs, cs, x, 1, &beta, y, 1, NULL );
m, n, &alpha, a, rs, cs, x, 1, &beta, y, 1 );
bli_dprintm( "y: after gemv", 1, m, y, m, 1, "%4.1f", "" );
@@ -151,21 +151,21 @@ int main( int argc, char** argv )
alpha = 1.0;
// Initialize vector 'x'.
bli_drandv( m, x, 1, NULL );
bli_drandv( m, x, 1 );
// Zero out all of matrix 'a'. This is optional, but will avoid possibly
// displaying junk values in the unstored triangle.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &zero, a, rs, cs, NULL );
m, m, &zero, a, rs, cs );
// Randomize the lower triangle of 'a'.
bli_drandm( 0, BLIS_LOWER, m, m, a, rs, cs, NULL );
bli_drandm( 0, BLIS_LOWER, m, m, a, rs, cs );
bli_dprintm( "x: set to random values", 1, m, x, m, 1, "%4.1f", "" );
bli_dprintm( "a: initial value (zeros in upper triangle)", m, m, a, 1, m, "%4.1f", "" );
// a := a + alpha * x * x^T, where 'a' is symmetric and lower-stored.
bli_dsyr( BLIS_LOWER, BLIS_NO_CONJUGATE, m, &alpha, x, 1, a, rs, cs, NULL );
bli_dsyr( BLIS_LOWER, BLIS_NO_CONJUGATE, m, &alpha, x, 1, a, rs, cs );
bli_dprintm( "a: after syr", m, m, a, 1, m, "%4.1f", "" );
@@ -191,16 +191,16 @@ int main( int argc, char** argv )
beta = 1.0;
// Initialize vectors 'x' and 'y'.
bli_dsetv( BLIS_NO_CONJUGATE, m, &one, x, 1, NULL );
bli_dsetv( BLIS_NO_CONJUGATE, m, &zero, y, 1, NULL );
bli_dsetv( BLIS_NO_CONJUGATE, m, &one, x, 1 );
bli_dsetv( BLIS_NO_CONJUGATE, m, &zero, y, 1 );
// Zero out all of matrix 'a'. This is optional, but will avoid possibly
// displaying junk values in the unstored triangle.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &zero, a, rs, cs, NULL );
m, m, &zero, a, rs, cs );
// Randomize 'a'.
bli_drandm( 0, BLIS_UPPER, m, m, a, rs, cs, NULL );
bli_drandm( 0, BLIS_UPPER, m, m, a, rs, cs );
bli_dprintm( "a: randomized (zeros in lower triangle)", m, m, a, rs, cs, "%4.1f", "" );
bli_dprintm( "x: set to 1.0", 1, m, x, m, 1, "%4.1f", "" );
@@ -208,7 +208,7 @@ int main( int argc, char** argv )
// y := beta * y + alpha * a * x, where 'a' is symmetric and upper-stored.
bli_dsymv( BLIS_UPPER, BLIS_NO_TRANSPOSE, BLIS_NO_CONJUGATE,
m, &alpha, a, rs, cs, x, 1, &beta, y, 1, NULL );
m, &alpha, a, rs, cs, x, 1, &beta, y, 1 );
bli_dprintm( "y: after symv", 1, m, y, m, 1, "%4.1f", "" );
@@ -233,22 +233,22 @@ int main( int argc, char** argv )
alpha = 1.0;
// Initialize vector 'x'.
bli_dsetv( BLIS_NO_CONJUGATE, m, &one, x, 1, NULL );
bli_dsetv( BLIS_NO_CONJUGATE, m, &one, x, 1 );
// Zero out all of matrix 'a'. This is optional, but will avoid possibly
// displaying junk values in the unstored triangle.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &zero, a, rs, cs, NULL );
m, m, &zero, a, rs, cs );
// Randomize 'a'.
bli_drandm( 0, BLIS_LOWER, m, m, a, rs, cs, NULL );
bli_drandm( 0, BLIS_LOWER, m, m, a, rs, cs );
bli_dprintm( "a: randomized (zeros in upper triangle)", m, m, a, rs, cs, "%4.1f", "" );
bli_dprintm( "x: intial value", 1, m, x, m, 1, "%4.1f", "" );
// x := alpha * a * x, where 'a' is triangular and lower-stored.
bli_dtrmv( BLIS_LOWER, BLIS_NO_TRANSPOSE, BLIS_NONUNIT_DIAG,
m, &alpha, a, rs, cs, x, 1, NULL );
m, &alpha, a, rs, cs, x, 1 );
bli_dprintm( "x: after trmv", 1, m, x, m, 1, "%4.1f", "" );
@@ -273,38 +273,38 @@ int main( int argc, char** argv )
alpha = 1.0;
// Initialize vector 'x'.
bli_dsetv( BLIS_NO_CONJUGATE, m, &one, b, 1, NULL );
bli_dsetv( BLIS_NO_CONJUGATE, m, &one, b, 1 );
// Zero out all of matrix 'a'. This is optional, but will avoid possibly
// displaying junk values in the unstored triangle.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &zero, a, rs, cs, NULL );
m, m, &zero, a, rs, cs );
// Randomize 'a'.
bli_drandm( 0, BLIS_LOWER, m, m, a, rs, cs, NULL );
bli_drandm( 0, BLIS_LOWER, m, m, a, rs, cs );
// 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, NULL );
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, NULL );
m, m, d, 1, m, 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", "" );
// x := alpha * a * x, where 'a' is triangular and lower-stored.
bli_dtrsv( BLIS_LOWER, BLIS_NO_TRANSPOSE, BLIS_NONUNIT_DIAG,
m, &alpha, a, rs, cs, x, 1, NULL );
m, &alpha, a, rs, cs, x, 1 );
bli_dprintm( "b: after trsv", 1, m, b, m, 1, "%4.1f", "" );
// We can confirm the solution by comparing the product of a and x to the
// original value of b.
bli_dcopyv( BLIS_NO_TRANSPOSE, m, b, 1, y, 1, NULL );
bli_dcopyv( BLIS_NO_TRANSPOSE, m, b, 1, y, 1 );
bli_dtrmv( BLIS_LOWER, BLIS_NO_TRANSPOSE, BLIS_NONUNIT_DIAG,
m, &alpha, a, rs, cs, y, 1, NULL );
m, &alpha, a, rs, cs, y, 1 );
bli_dprintm( "y: should equal initial value of b", 1, m, y, m, 1, "%4.1f", "" );

View File

@@ -79,11 +79,11 @@ int main( int argc, char** argv )
beta = 1.0;
// Initialize the matrix operands.
bli_drandm( 0, BLIS_DENSE, m, k, a, rsa, csa, NULL );
bli_drandm( 0, BLIS_DENSE, m, k, a, rsa, csa );
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
k, n, &one, b, rsb, csb, NULL );
k, n, &one, b, rsb, csb );
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &zero, c, rsc, csc, NULL );
m, n, &zero, c, rsc, csc );
bli_dprintm( "a: randomized", m, k, a, rsa, csa, "%4.1f", "" );
bli_dprintm( "b: set to 1.0", k, n, b, rsb, csb, "%4.1f", "" );
@@ -92,7 +92,7 @@ int main( int argc, char** argv )
// c := beta * c + alpha * a * b, where 'a', 'b', and 'c' are general.
bli_dgemm( BLIS_NO_TRANSPOSE, BLIS_NO_TRANSPOSE,
m, n, k, &alpha, a, rsa, csa, b, rsb, csb,
&beta, c, rsc, csc, NULL );
&beta, c, rsc, csc );
bli_dprintm( "c: after gemm", m, n, c, rsc, csc, "%4.1f", "" );
@@ -123,11 +123,11 @@ int main( int argc, char** argv )
beta = 1.0;
// Initialize the matrix operands.
bli_drandm( 0, BLIS_DENSE, k, m, a, rsa, csa, NULL );
bli_drandm( 0, BLIS_DENSE, k, m, a, rsa, csa );
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
k, n, &one, b, rsb, csb, NULL );
k, n, &one, b, rsb, csb );
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &zero, c, rsc, csc, NULL );
m, n, &zero, c, rsc, csc );
bli_dprintm( "a: randomized", k, m, a, rsa, csa, "%4.1f", "" );
bli_dprintm( "b: set to 1.0", k, n, b, rsb, csb, "%4.1f", "" );
@@ -136,7 +136,7 @@ int main( int argc, char** argv )
// c := beta * c + alpha * a^T * b, where 'a', 'b', and 'c' are general.
bli_dgemm( BLIS_TRANSPOSE, BLIS_NO_TRANSPOSE,
m, n, k, &alpha, a, rsa, csa, b, rsb, csb,
&beta, c, rsc, csc, NULL );
&beta, c, rsc, csc );
bli_dprintm( "c: after gemm", m, n, c, rsc, csc, "%4.1f", "" );
@@ -164,11 +164,11 @@ int main( int argc, char** argv )
// Initialize the matrix operands.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &zero, c, rsc, csc, NULL );
bli_drandm( 0, BLIS_DENSE, m, k, a, rsa, csa, NULL );
m, m, &zero, c, rsc, csc );
bli_drandm( 0, BLIS_DENSE, m, k, a, rsa, csa );
// Randomize the lower triangle of 'c'.
bli_drandm( 0, BLIS_LOWER, m, n, c, rsc, csc, NULL );
bli_drandm( 0, BLIS_LOWER, m, n, c, rsc, csc );
bli_dprintm( "a: set to random values", m, k, a, rsa, csa, "%4.1f", "" );
bli_dprintm( "c: initial value (zeros in upper triangle)", m, m, c, rsc, csc, "%4.1f", "" );
@@ -176,7 +176,7 @@ int main( int argc, char** argv )
// c := c + alpha * a * a^T, where 'c' is symmetric and lower-stored.
bli_dsyrk( BLIS_LOWER, BLIS_NO_TRANSPOSE,
m, k, &alpha, a, rsa, csa,
&beta, c, rsc, csc, NULL );
&beta, c, rsc, csc );
bli_dprintm( "c: after syrk", m, m, c, rsc, csc, "%4.1f", "" );
@@ -206,17 +206,17 @@ int main( int argc, char** argv )
// Initialize matrices 'b' and 'c'.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &one, b, rsb, csb, NULL );
m, n, &one, b, rsb, csb );
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &zero, c, rsc, csc, NULL );
m, n, &zero, c, rsc, csc );
// Zero out all of matrix 'a'. This is optional, but will avoid possibly
// displaying junk values in the unstored triangle.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &zero, a, rsa, csa, NULL );
m, m, &zero, a, rsa, csa );
// Randomize the upper triangle of 'a'.
bli_drandm( 0, BLIS_UPPER, m, m, a, rsa, csa, NULL );
bli_drandm( 0, BLIS_UPPER, m, m, a, rsa, csa );
bli_dprintm( "a: randomized (zeros in lower triangle)", m, m, a, rsa, csa, "%4.1f", "" );
bli_dprintm( "b: set to 1.0", m, n, b, rsb, csb, "%4.1f", "" );
@@ -225,7 +225,7 @@ int main( int argc, char** argv )
// c := beta * c + alpha * a * b, where 'a' is symmetric and upper-stored.
bli_dsymm( BLIS_LEFT, BLIS_UPPER, BLIS_NO_CONJUGATE, BLIS_NO_TRANSPOSE,
m, n, &alpha, a, rsa, csa, b, rsb, csb,
&beta, c, rsc, csc, NULL );
&beta, c, rsc, csc );
bli_dprintm( "c: after symm", m, n, c, rsc, csc, "%4.1f", "" );
@@ -253,22 +253,22 @@ int main( int argc, char** argv )
// Initialize matrix 'b'.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &one, b, rsb, csb, NULL );
m, n, &one, b, rsb, csb );
// Zero out all of matrix 'a'. This is optional, but will avoid possibly
// displaying junk values in the unstored triangle.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &zero, a, rsa, csa, NULL );
m, m, &zero, a, rsa, csa );
// Randomize the lower triangle of 'a'.
bli_drandm( 0, BLIS_LOWER, m, m, a, rsa, csa, NULL );
bli_drandm( 0, BLIS_LOWER, m, m, 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", "" );
// b := alpha * a * b, where 'a' is triangular and lower-stored.
bli_dtrmm( BLIS_LEFT, BLIS_LOWER, BLIS_NONUNIT_DIAG, BLIS_NO_TRANSPOSE,
m, n, &alpha, a, rsa, csa, b, rsb, csb, NULL );
m, n, &alpha, a, rsa, csa, b, rsb, csb );
bli_dprintm( "b: after trmm", m, n, b, rsb, csb, "%4.1f", "" );
@@ -298,23 +298,23 @@ int main( int argc, char** argv )
// Initialize matrix 'b'.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, &one, b, rsb, csb, NULL );
m, n, &one, b, rsb, csb );
// Zero out all of matrix 'a'. This is optional, but will avoid possibly
// displaying junk values in the unstored triangle.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &zero, a, rsa, csa, NULL );
m, m, &zero, a, rsa, csa );
// Randomize the lower triangle of 'a'.
bli_drandm( 0, BLIS_LOWER, m, m, a, rsa, csa, NULL );
bli_drandm( 0, BLIS_LOWER, m, m, a, rsa, csa );
// 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, NULL );
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, NULL );
m, m, d, 1, m, 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", "" );
@@ -322,16 +322,16 @@ int main( int argc, char** argv )
// solve a * x = alpha * b, where 'a' is triangular and lower-stored, and
// overwrite b with the solution matrix x.
bli_dtrsm( BLIS_LEFT, BLIS_LOWER, BLIS_NONUNIT_DIAG, BLIS_NO_TRANSPOSE,
m, n, &alpha, a, rsa, csa, b, rsb, csb, NULL );
m, n, &alpha, a, rsa, csa, b, rsb, csb );
bli_dprintm( "b: after trmm", m, n, b, rsb, csb, "%4.1f", "" );
// We can confirm the solution by comparing the product of a and x to the
// original value of b.
bli_dcopym( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE, BLIS_NO_TRANSPOSE,
m, n, b, rsb, csb, c, rsc, csc, NULL );
m, n, b, rsb, csb, c, rsc, csc );
bli_dtrmm( BLIS_LEFT, BLIS_LOWER, BLIS_NONUNIT_DIAG, BLIS_NO_TRANSPOSE,
m, n, &alpha, a, rsa, csa, c, rsc, csc, NULL );
m, n, &alpha, a, rsa, csa, c, rsc, csc );
bli_dprintm( "c: should equal initial value of b", m, n, c, rsc, csc, "%4.1f", "" );

View File

@@ -73,17 +73,17 @@ int main( int argc, char** argv )
y = malloc( m * n * sizeof( dcomplex ) );
// Initialize the vectors to random values.
bli_drandv( n, x, 1, NULL );
bli_zrandv( n, y, 1, NULL );
bli_drandv( n, x, 1 );
bli_zrandv( n, y, 1 );
bli_dprintm( "x", m, n, x, rs, cs, "%4.1f", "" );
// Compute the one, infinity, and frobenius norms of 'x'. Note that when
// computing the norm alpha of a vector 'x', the datatype of alpha must be
// equal to the real projection of the datatype of 'x'.
bli_dnorm1v( n, x, 1, &norm1, NULL );
bli_dnormiv( n, x, 1, &normi, NULL );
bli_dnormfv( n, x, 1, &normf, NULL );
bli_dnorm1v( n, x, 1, &norm1 );
bli_dnormiv( n, x, 1, &normi );
bli_dnormfv( n, x, 1, &normf );
bli_dprintm( "x: 1-norm:", 1, 1, &norm1, rs, cs, "%4.1f", "" );
bli_dprintm( "x: infinity norm:", 1, 1, &normi, rs, cs, "%4.1f", "" );
@@ -94,9 +94,9 @@ int main( int argc, char** argv )
// Compute the one, infinity, and frobenius norms of 'y'. Note that we
// can reuse the same scalars from before for computing norms of
// dcomplex matrices, since the real projection of dcomplex is double.
bli_znorm1v( n, y, 1, &norm1, NULL );
bli_znormiv( n, y, 1, &normi, NULL );
bli_znormfv( n, y, 1, &normf, NULL );
bli_znorm1v( n, y, 1, &norm1 );
bli_znormiv( n, y, 1, &normi );
bli_znormfv( n, y, 1, &normf );
bli_dprintm( "y: 1-norm:", 1, 1, &norm1, 1, 1, "%4.1f", "" );
bli_dprintm( "y: infinity norm:", 1, 1, &normi, 1, 1, "%4.1f", "" );
@@ -115,18 +115,18 @@ int main( int argc, char** argv )
b = malloc( m * n * sizeof( dcomplex ) );
// Initialize the matrices to random values.
bli_drandm( 0, BLIS_DENSE, m, n, a, rs, cs, NULL );
bli_zrandm( 0, BLIS_DENSE, m, n, b, rs, cs, NULL );
bli_drandm( 0, BLIS_DENSE, m, n, a, rs, cs );
bli_zrandm( 0, BLIS_DENSE, m, n, b, rs, cs );
bli_dprintm( "a:", m, n, a, rs, cs, "%4.1f", "" );
// Compute the one-norm of 'a'.
bli_dnorm1m( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, a, rs, cs, &norm1, NULL );
m, n, a, rs, cs, &norm1 );
bli_dnormim( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, a, rs, cs, &normi, NULL );
m, n, a, rs, cs, &normi );
bli_dnormfm( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, a, rs, cs, &normf, NULL );
m, n, a, rs, cs, &normf );
bli_dprintm( "a: 1-norm:", 1, 1, &norm1, 1, 1, "%4.1f", "" );
bli_dprintm( "a: infinity norm:", 1, 1, &normi, 1, 1, "%4.1f", "" );
@@ -136,11 +136,11 @@ int main( int argc, char** argv )
// Compute the one-norm of 'b'.
bli_znorm1m( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, b, rs, cs, &norm1, NULL );
m, n, b, rs, cs, &norm1 );
bli_znormim( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, b, rs, cs, &normi, NULL );
m, n, b, rs, cs, &normi );
bli_znormfm( 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, n, b, rs, cs, &normf, NULL );
m, n, b, rs, cs, &normf );
bli_dprintm( "a: 1-norm:", 1, 1, &norm1, 1, 1, "%4.1f", "" );
bli_dprintm( "a: infinity norm:", 1, 1, &normi, 1, 1, "%4.1f", "" );
@@ -160,16 +160,16 @@ int main( int argc, char** argv )
// Initialize all of 'c' to -1.0 to simulate junk values.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &minus_one, c, rs, cs, NULL );
m, m, &minus_one, c, rs, cs );
// Randomize the lower triangle of 'c'.
bli_drandm( 0, BLIS_LOWER, m, m, c, rs, cs, NULL );
bli_drandm( 0, BLIS_LOWER, m, m, c, rs, cs );
bli_dprintm( "c (initial state):", m, m, c, rs, cs, "%4.1f", "" );
// mksymm on a real matrix transposes the stored triangle into the
// unstored triangle, making the matrix densely symmetric.
bli_dmksymm( BLIS_LOWER, m, c, rs, cs, NULL );
bli_dmksymm( BLIS_LOWER, m, c, rs, cs );
bli_dprintm( "c (after mksymm on lower triangle):", m, m, c, rs, cs, "%4.1f", "" );
@@ -181,16 +181,16 @@ int main( int argc, char** argv )
// Initialize all of 'd' to -1.0 to simulate junk values.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &minus_one, d, rs, cs, NULL );
m, m, &minus_one, d, rs, cs );
// Randomize the lower triangle of 'd'.
bli_drandm( 0, BLIS_LOWER, m, m, d, rs, cs, NULL );
bli_drandm( 0, BLIS_LOWER, m, m, d, rs, cs );
bli_dprintm( "d (initial state):", m, m, d, rs, cs, "%4.1f", "" );
// mkherm on a real matrix behaves the same as mksymm, as there are no
// imaginary elements to conjugate.
bli_dmkherm( BLIS_LOWER, m, d, rs, cs, NULL );
bli_dmkherm( BLIS_LOWER, m, d, rs, cs );
bli_dprintm( "c (after mkherm on lower triangle):", m, m, d, rs, cs, "%4.1f", "" );
@@ -208,31 +208,31 @@ int main( int argc, char** argv )
// Initialize all of 'e' to -1.0 to simulate junk values.
bli_zsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &minus_one_z, e, rs, cs, NULL );
m, m, &minus_one_z, e, rs, cs );
// Randomize the upper triangle of 'e'.
bli_zrandm( 0, BLIS_UPPER, m, m, e, rs, cs, NULL );
bli_zrandm( 0, BLIS_UPPER, m, m, e, rs, cs );
bli_zprintm( "e (initial state):", m, m, e, rs, cs, "%4.1f", "" );
// mksymm on a complex matrix transposes the stored triangle into the
// unstored triangle.
bli_zmksymm( BLIS_UPPER, m, e, rs, cs, NULL );
bli_zmksymm( BLIS_UPPER, m, e, rs, cs );
bli_zprintm( "e (after mksymm on lower triangle):", m, m, e, rs, cs, "%4.1f", "" );
// Initialize all of 'f' to -1.0 to simulate junk values.
bli_zsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &minus_one_z, f, rs, cs, NULL );
m, m, &minus_one_z, f, rs, cs );
// Randomize the upper triangle of 'd'.
bli_zrandm( 0, BLIS_UPPER, m, m, f, rs, cs, NULL );
bli_zrandm( 0, BLIS_UPPER, m, m, f, rs, cs );
bli_zprintm( "f (initial state):", m, m, f, rs, cs, "%4.1f", "" );
// mkherm on a real matrix behaves the same as mksymm, as there are no
// imaginary elements to conjugate.
bli_zmkherm( BLIS_UPPER, m, f, rs, cs, NULL );
bli_zmkherm( BLIS_UPPER, m, f, rs, cs );
bli_zprintm( "f (after mkherm on lower triangle):", m, m, f, rs, cs, "%4.1f", "" );
@@ -249,17 +249,17 @@ int main( int argc, char** argv )
// Initialize all of 'g' to -1.0 to simulate junk values.
bli_dsetm( BLIS_NO_CONJUGATE, 0, BLIS_NONUNIT_DIAG, BLIS_DENSE,
m, m, &minus_one, g, rs, cs, NULL );
m, m, &minus_one, g, rs, cs );
// Randomize the lower triangle of 'g'.
bli_drandm( 0, BLIS_LOWER, m, m, g, rs, cs, NULL );
bli_drandm( 0, BLIS_LOWER, m, m, g, rs, cs );
bli_dprintm( "g (initial state):", m, m, g, rs, cs, "%4.1f", "" );
// mktrim does not explicitly copy any data, since presumably the stored
// triangle already contains the data of interest. However, mktrim does
// explicitly writes zeros to the unstored region.
bli_dmktrim( BLIS_LOWER, m, g, rs, cs, NULL );
bli_dmktrim( BLIS_LOWER, m, g, rs, cs );
bli_dprintm( "g (after mktrim):", m, m, g, rs, cs, "%4.1f", "" );