### ----------------------------------------------------
### -- Math::Libgsl::Matrix
### -- Licenses: Artistic-2.0
### -- Authors: Fernando Santagata
### -- File: t/01-raw-matrix.rakutest
### ----------------------------------------------------
### -- Chunk 2 of 2
(4, 4);
  gsl_matrix_set_zero($m1);
  ok gsl_matrix_isnull($m1) == 1, 'matrix isnull';
  nok gsl_matrix_ispos($m1) == 1, 'matrix ispos';
  nok gsl_matrix_isneg($m1) == 1, 'matrix isneg';
  ok gsl_matrix_isnonneg($m1) == 1, 'matrix isnonneg';
  my gsl_matrix $m2 = gsl_matrix_alloc(4, 4);
  gsl_matrix_set_zero($m2);
  ok gsl_matrix_equal($m1, $m2) == 1, 'matrix equal';
  if $gsl-version > v2.6 {
    gsl_matrix_set_all($m1, 2e0);
    ok gsl_matrix_norm1($m1) == 8e0, 'matrix 1-norm';
  }
  gsl_matrix_free($m1);
  gsl_matrix_free($m2);
}, 'matrix properties';

if $gsl-version > v2.6 {
  subtest {
    my gsl_matrix_complex $src = gsl_matrix_complex_calloc(2, 3);
    my gsl_matrix_complex $dst = gsl_matrix_complex_calloc(3, 2);
    my $c = alloc_gsl_complex;
    my $*TOLERANCE = 10⁻¹²;
    for ^2 X ^3 -> ($i, $j) {
      my num64 $ri = $i.Num;
      my num64 $rj = $j.Num;
      mgsl_complex_rect($ri, $rj, $c);
      mgsl_matrix_complex_set($src, $i, $j, $c);
    }
    ok gsl_matrix_complex_conjtrans_memcpy($dst, $src) == GSL_SUCCESS, 'can compute the conjugate transpose';
    ok ([&&] (gather for ^3 X ^2 -> ($i, $j) {
        mgsl_matrix_complex_get($dst, $i, $j, $c);
        take $c.dat[0]; take $c.dat[1];
      })
      Z≅
      (0e0, 0e0, 1e0, 0e0, 0e0, -1e0, 1e0, -1e0, 0e0, -2e0, 1e0, -2e0)
    ), 'conjugate transpose';
    free_gsl_complex($c);
    gsl_matrix_complex_free($dst);
    gsl_matrix_complex_free($src);
  }, 'new in v. 2.7';
}

done-testing;


