### ----------------------------------------------------
### -- Math::Libgsl::BLAS
### -- Licenses: Artistic-2.0
### -- Authors: Fernando Santagata
### -- File: t/01-raw.rakutest
### ----------------------------------------------------
### -- Chunk 4 of 4
 $z);
  mgsl_matrix_complex_set($zB5, 0, 0, $z);
  mgsl_complex_rect(.796e0, .293e0, $z);
  mgsl_matrix_complex_set($zB5, 0, 1, $z);
  mgsl_complex_rect(.876e0, -.199e0, $z);
  mgsl_matrix_complex_set($zB5, 1, 0, $z);
  mgsl_complex_rect(-.757e0, -.103e0, $z);
  mgsl_matrix_complex_set($zB5, 1, 1, $z);
  ok mgsl_blas_zsyrk(CblasUpper, CblasNoTrans, $zα, $zA5, $zβ, $zB5) == GSL_SUCCESS, 'αAT(A) + βB: complex64';
  is-deeply (gather for ^2 -> $i { for ^2 -> $j { mgsl_matrix_complex_get($zB5, $i, $j, $zres); take $zres.dat[0]; take $zres.dat[1] } } ), (0.46743199999999996e0, -0.04567399999999999e0, 1.019244e0, 0.576752e0, 0.876e0, -0.199e0, -0.65508e0, -0.35819199999999995e0), 'result: ok';

  $α = 0e0; $β = .1e0;
  my gsl_matrix_complex_float $cA6 = gsl_matrix_complex_float_calloc(2, 1);
  mgsl_complex_float_rect(-.617e0, .179e0, $c);
  mgsl_matrix_complex_float_set($cA6, 0, 0, $c);
  mgsl_complex_float_rect(-.626e0, .334e0, $c);
  mgsl_matrix_complex_float_set($cA6, 1, 0, $c);
  my gsl_matrix_complex_float $cB6 = gsl_matrix_complex_float_calloc(2, 2);
  mgsl_complex_float_rect(.346e0, -.903e0, $c);
  mgsl_matrix_complex_float_set($cB6, 0, 0, $c);
  mgsl_complex_float_rect(.022e0, -.839e0, $c);
  mgsl_matrix_complex_float_set($cB6, 0, 1, $c);
  mgsl_complex_float_rect(-.715e0, .049e0, $c);
  mgsl_matrix_complex_float_set($cB6, 1, 0, $c);
  mgsl_complex_float_rect(-.338e0, .149e0, $c);
  mgsl_matrix_complex_float_set($cB6, 1, 1, $c);
  ok gsl_blas_cherk(CblasUpper, CblasNoTrans, $α, $cA6, $β, $cB6) == GSL_SUCCESS, 'αAH(A) + βB: complex32';
  is-deeply (gather for ^2 -> $i { for ^2 -> $j { mgsl_matrix_complex_float_get($cB6, $i, $j, $cres); take $cres.dat[0]; take $cres.dat[1] } }), (0.03460000082850456e0, 0e0, 0.002199999988079071e0, -0.08389999717473984e0, -0.7149999737739563e0, 0.04899999871850014e0, -0.03380000218749046e0, 0e0), 'result: ok';

  $α = 1e0; $β = 1e0;
  my gsl_matrix_complex $zA6 = gsl_matrix_complex_calloc(2, 1);
  mgsl_complex_rect(.934e0, .664e0, $z);
  mgsl_matrix_complex_set($zA6, 0, 0, $z);
  mgsl_complex_rect(.426e0, .263e0, $z);
  mgsl_matrix_complex_set($zA6, 1, 0, $z);
  my gsl_matrix_complex $zB6 = gsl_matrix_complex_calloc(2, 2);
  mgsl_complex_rect(.251e0, -.97e0, $z);
  mgsl_matrix_complex_set($zB6, 0, 0, $z);
  mgsl_complex_rect(.76e0, -.349e0, $z);
  mgsl_matrix_complex_set($zB6, 0, 1, $z);
  mgsl_complex_rect(.152e0, -.899e0, $z);
  mgsl_matrix_complex_set($zB6, 1, 0, $z);
  mgsl_complex_rect(-.17e0, .707e0, $z);
  mgsl_matrix_complex_set($zB6, 1, 1, $z);
  ok gsl_blas_zherk(CblasUpper, CblasNoTrans, $α, $zA6, $β, $zB6) == GSL_SUCCESS, 'αAH(A) + βB: complex64';
  is-deeply (gather for ^2 -> $i { for ^2 -> $j { mgsl_matrix_complex_get($zB6, $i, $j, $zres); take $zres.dat[0]; take $zres.dat[1] } } ), (1.5642520000000002e0, 0e0, 1.332516e0, -0.311778e0, 0.152e0, -0.899e0, 0.080645e0, 0e0), 'result: ok';

  $α = .1e0; $β = 1e0;
  my gsl_matrix_float $A7 = gsl_matrix_float_calloc(1, 2);
  gsl_matrix_float_set($A7, 0, 0, -.915e0);
  gsl_matrix_float_set($A7, 0, 1,  .445e0);
  my gsl_matrix_float $B7 = gsl_matrix_float_calloc(1, 2);
  gsl_matrix_float_set($B7, 0, 0,  .213e0);
  gsl_matrix_float_set($B7, 0, 1, -.194e0);
  my gsl_matrix_float $C7 = gsl_matrix_float_calloc(1, 1);
  gsl_matrix_float_set($C7, 0, 0, -.117e0);
  ok gsl_blas_ssyr2k(CblasUpper, CblasNoTrans, $α, $A7, $B7, $β, $C7) == GSL_SUCCESS, 'αAT(B) + αBT(A) + βC: num32';
  ok gsl_matrix_float_get($C7, 0, 0) == -0.17324499785900116e0, 'result: ok';

  $α = .1e0; $β = 0e0;
  my gsl_matrix $dA7 = gsl_matrix_calloc(1, 2);
  gsl_matrix_set($dA7, 0, 0, -.225e0);
  gsl_matrix_set($dA7, 0, 1,  .857e0);
  my gsl_matrix $dB7 = gsl_matrix_calloc(1, 2);
  gsl_matrix_set($dB7, 0, 0, -.933e0);
  gsl_matrix_set($dB7, 0, 1,  .994e0);
  my gsl_matrix $dC7 = gsl_matrix_calloc(1, 1);
  gsl_matrix_set($dC7, 0, 0, .177e0);
  ok gsl_blas_dsyr2k(CblasUpper, CblasNoTrans, $α, $dA7, $dB7, $β, $dC7) == GSL_SUCCESS, 'αAT(B) + αBT(A) + βC: num64';
  ok gsl_matrix_get($dC7, 0, 0) == 0.21235660000000003e0, 'result: ok';

  mgsl_complex_float_rect(0e0, .1e0, $cα);
  mgsl_complex_float_rect(0e0, 0e0, $cβ);
  my gsl_matrix_complex_float $cA7 = gsl_matrix_complex_float_calloc(1, 2);
  mgsl_complex_float_rect(-.248e0, -.037e0, $c);
  mgsl_matrix_complex_float_set($cA7, 0, 0, $c);
  mgsl_complex_float_rect(-.124e0, .998e0, $c);
  mgsl_matrix_complex_float_set($cA7, 0, 1, $c);
  my gsl_matrix_complex_float $cB7 = gsl_matrix_complex_float_calloc(1, 2);
  mgsl_complex_float_rect(-.608e0, -.115e0, $c);
  mgsl_matrix_complex_float_set($cB7, 0, 0, $c);
  mgsl_complex_float_rect(-.718e0, -.551e0, $c);
  mgsl_matrix_complex_float_set($cB7, 0, 1, $c);
  my gsl_matrix_complex_float $cC7 = gsl_matrix_complex_float_calloc(1, 1);
  mgsl_complex_float_rect(.187e0, -.329e0, $c);
  mgsl_matrix_complex_float_set($cC7, 0, 0, $c);
  ok mgsl_blas_csyr2k(CblasUpper, CblasNoTrans, $cα, $cA7, $cB7, $cβ, $cC7) == GSL_SUCCESS, 'αAT(B) + αBT(A) + βC: complex32';
  is-deeply (gather { mgsl_matrix_complex_float_get($cC7, 0, 0, $cres); take $cres.dat[0]; take $cres.dat[1] }), (0.11944480240345001e0, 0.15709181129932404e0), 'result: ok';

  mgsl_complex_rect(0e0, 0e0, $zα);
  mgsl_complex_rect(-.3e0, .1e0, $zβ);
  my gsl_matrix_complex $zA7 = gsl_matrix_complex_calloc(1, 2);
  mgsl_complex_rect(-.315e0, .03e0, $z);
  mgsl_matrix_complex_set($zA7, 0, 0, $z);
  mgsl_complex_rect(.218e0, .175e0, $z);
  mgsl_matrix_complex_set($zA7, 0, 1, $z);
  my gsl_matrix_complex $zB7 = gsl_matrix_complex_calloc(1, 2);
  mgsl_complex_rect(-.832e0, -.964e0, $z);
  mgsl_matrix_complex_set($zB7, 0, 0, $z);
  mgsl_complex_rect(.291e0, .476e0, $z);
  mgsl_matrix_complex_set($zB7, 0, 1, $z);
  my gsl_matrix_complex $zC7 = gsl_matrix_complex_calloc(1, 1);
  mgsl_complex_rect(-.341e0, .743e0, $z);
  mgsl_matrix_complex_set($zC7, 0, 0, $z);
  ok mgsl_blas_zsyr2k(CblasUpper, CblasNoTrans, $zα, $zA7, $zB7, $zβ, $zC7) == GSL_SUCCESS, 'αAT(B) + αBT(A) + βC: complex64';
  is-deeply (gather { mgsl_matrix_complex_get($zC7, 0, 0, $zres); take $zres.dat[0]; take $zres.dat[1] }), (0.027999999999999997e0, -0.257e0), 'result: ok';

  mgsl_complex_float_rect(-1e0, 0e0, $cα);
  $β = -.3e0;
  my gsl_matrix_complex_float $cA8 = gsl_matrix_complex_float_calloc(1, 2);
  mgsl_complex_float_rect(.178e0, .545e0, $c);
  mgsl_matrix_complex_float_set($cA8, 0, 0, $c);
  mgsl_complex_float_rect(-.491e0, .979e0, $c);
  mgsl_matrix_complex_float_set($cA8, 0, 1, $c);
  my gsl_matrix_complex_float $cB8 = gsl_matrix_complex_float_calloc(1, 2);
  mgsl_complex_float_rect(-.665e0, -.531e0, $c);
  mgsl_matrix_complex_float_set($cB8, 0, 0, $c);
  mgsl_complex_float_rect(-.4e0, .227e0, $c);
  mgsl_matrix_complex_float_set($cB8, 0, 1, $c);
  my gsl_matrix_complex_float $cC8 = gsl_matrix_complex_float_calloc(1, 1);
  mgsl_complex_float_rect(.115e0, -.193e0, $c);
  mgsl_matrix_complex_float_set($cC8, 0, 0, $c);
  ok mgsl_blas_cher2k(CblasUpper, CblasNoTrans, $cα, $cA8, $cB8, $β, $cC8) == GSL_SUCCESS, 'αAH(B) + αBH(A) + βC: complex32';
  is-deeply (gather { mgsl_matrix_complex_float_get($cC8, 0, 0, $cres); take $cres.dat[0]; take $cres.dat[1] }), (-0.05623596906661987e0, 0e0), 'result: ok';

  mgsl_complex_rect(1e0, 0e0, $zα);
  $β = 1e0;
  my gsl_matrix_complex $zA8 = gsl_matrix_complex_calloc(1, 2);
  mgsl_complex_rect(.515e0, -.034e0, $z);
  mgsl_matrix_complex_set($zA8, 0, 0, $z);
  mgsl_complex_rect(.067e0, .66e0, $z);
  mgsl_matrix_complex_set($zA8, 0, 1, $z);
  my gsl_matrix_complex $zB8 = gsl_matrix_complex_calloc(1, 2);
  mgsl_complex_rect(.408e0, -.85e0, $z);
  mgsl_matrix_complex_set($zB8, 0, 0, $z);
  mgsl_complex_rect(-.945e0, -.799e0, $z);
  mgsl_matrix_complex_set($zB8, 0, 1, $z);
  my gsl_matrix_complex $zC8 = gsl_matrix_complex_calloc(1, 1);
  mgsl_complex_rect(-.918e0, -.985e0, $z);
  mgsl_matrix_complex_set($zC8, 0, 0, $z);
  ok mgsl_blas_zher2k(CblasUpper, CblasNoTrans, $zα, $zA8, $zB8, $β, $zC8) == GSL_SUCCESS, 'αAH(B) + αBH(A) + βC: complex64';
  is-deeply (gather { mgsl_matrix_complex_get($zC8, 0, 0, $zres); take $zres.dat[0]; take $zres.dat[1] }), (-1.62127e0, 0e0), 'result: ok';
}, 'level 3 functions';

done-testing;


