text:
#include <gsl/gsl_test.h>
#include <gsl/gsl_ieee_utils.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_cblas.h>

#include "tests.h"

void
test_symm (void) {
const double flteps = 1e-4, dbleps = 1e-6;
  {
   int order = 101;
   int side = 141;
   int uplo = 121;
   int M = 1;
   int N = 2;
   float alpha = -0.3f;
   float beta = -1.0f;
   float A[] = { -0.581f };
   int lda = 1;
   float B[] = { 0.157f, 0.451f };
   int ldb = 2;
   float C[] = { -0.869f, -0.871f };
   int ldc = 2;
   float C_expected[] = { 0.896365f, 0.949609f };
   cblas_ssymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], flteps, "ssymm(case 1518)");
     }
   };
  };

  {
   int order = 102;
   int side = 141;
   int uplo = 121;
   int M = 1;
   int N = 2;
   float alpha = -0.3f;
   float beta = -1.0f;
   float A[] = { 0.874f };
   int lda = 1;
   float B[] = { 0.085f, 0.069f };
   int ldb = 1;
   float C[] = { -0.495f, -0.828f };
   int ldc = 1;
   float C_expected[] = { 0.472713f, 0.809908f };
   cblas_ssymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], flteps, "ssymm(case 1519)");
     }
   };
  };

  {
   int order = 101;
   int side = 142;
   int uplo = 121;
   int M = 1;
   int N = 2;
   float alpha = -1.0f;
   float beta = 0.0f;
   float A[] = { -0.671f, -0.343f, 0.6f, 0.177f };
   int lda = 2;
   float B[] = { 0.043f, 0.01f };
   int ldb = 2;
   float C[] = { 0.988f, 0.478f };
   int ldc = 2;
   float C_expected[] = { 0.032283f, 0.012979f };
   cblas_ssymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], flteps, "ssymm(case 1520)");
     }
   };
  };

  {
   int order = 102;
   int side = 142;
   int uplo = 121;
   int M = 1;
   int N = 2;
   float alpha = -1.0f;
   float beta = 0.0f;
   float A[] = { 0.069f, 0.096f, 0.139f, -0.044f };
   int lda = 2;
   float B[] = { -0.448f, 0.07f };
   int ldb = 1;
   float C[] = { 0.361f, 0.995f };
   int ldc = 1;
   float C_expected[] = { 0.021182f, 0.065352f };
   cblas_ssymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], flteps, "ssymm(case 1521)");
     }
   };
  };

  {
   int order = 101;
   int side = 141;
   int uplo = 122;
   int M = 1;
   int N = 2;
   float alpha = 0.0f;
   float beta = -0.3f;
   float A[] = { 0.745f };
   int lda = 1;
   float B[] = { -0.269f, 0.448f };
   int ldb = 2;
   float C[] = { -0.986f, 0.2f };
   int ldc = 2;
   float C_expected[] = { 0.2958f, -0.06f };
   cblas_ssymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], flteps, "ssymm(case 1522)");
     }
   };
  };

  {
   int order = 102;
   int side = 141;
   int uplo = 122;
   int M = 1;
   int N = 2;
   float alpha = 0.0f;
   float beta = -0.3f;
   float A[] = { 0.96f };
   int lda = 1;
   float B[] = { 0.392f, -0.07f };
   int ldb = 1;
   float C[] = { -0.235f, 0.554f };
   int ldc = 1;
   float C_expected[] = { 0.0705f, -0.1662f };
   cblas_ssymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], flteps, "ssymm(case 1523)");
     }
   };
  };

  {
   int order = 101;
   int side = 142;
   int uplo = 122;
   int M = 1;
   int N = 2;
   float alpha = -0.3f;
   float beta = 0.1f;
   float A[] = { -0.839f, 0.498f, -0.215f, -0.314f };
   int lda = 2;
   float B[] = { -0.66f, 0.593f };
   int ldb = 2;
   float C[] = { -0.806f, 0.525f };
   int ldc = 2;
   float C_expected[] = { -0.208474f, 0.0657906f };
   cblas_ssymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], flteps, "ssymm(case 1524)");
     }
   };
  };

  {
   int order = 102;
   int side = 142;
   int uplo = 122;
   int M = 1;
   int N = 2;
   float alpha = -0.3f;
   float beta = 0.1f;
   float A[] = { 0.994f, -0.117f, -0.639f, 0.925f };
   int lda = 2;
   float B[] = { -0.478f, 0.147f };
   int ldb = 1;
   float C[] = { -0.814f, 0.316f };
   int ldc = 1;
   float C_expected[] = { 0.0662993f, -0.0259703f };
   cblas_ssymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], flteps, "ssymm(case 1525)");
     }
   };
  };

  {
   int order = 101;
   int side = 141;
   int uplo = 121;
   int M = 1;
   int N = 2;
   double alpha = -0.3;
   double beta = 1;
   double A[] = { -0.981 };
   int lda = 1;
   double B[] = { -0.823, 0.83 };
   int ldb = 2;
   double C[] = { 0.991, 0.382 };
   int ldc = 2;
   double C_expected[] = { 0.7487911, 0.626269 };
   cblas_dsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], dbleps, "dsymm(case 1526)");
     }
   };
  };

  {
   int order = 102;
   int side = 141;
   int uplo = 121;
   int M = 1;
   int N = 2;
   double alpha = -0.3;
   double beta = 1;
   double A[] = { -0.248 };
   int lda = 1;
   double B[] = { 0.74, 0.068 };
   int ldb = 1;
   double C[] = { -0.905, 0.742 };
   int ldc = 1;
   double C_expected[] = { -0.849944, 0.7470592 };
   cblas_dsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], dbleps, "dsymm(case 1527)");
     }
   };
  };

  {
   int order = 101;
   int side = 142;
   int uplo = 121;
   int M = 1;
   int N = 2;
   double alpha = -1;
   double beta = 1;
   double A[] = { 0.591, -0.01, -0.192, -0.376 };
   int lda = 2;
   double B[] = { 0.561, 0.946 };
   int ldb = 2;
   double C[] = { 0.763, 0.189 };
   int ldc = 2;
   double C_expected[] = { 0.440909, 0.550306 };
   cblas_dsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], dbleps, "dsymm(case 1528)");
     }
   };
  };

  {
   int order = 102;
   int side = 142;
   int uplo = 121;
   int M = 1;
   int N = 2;
   double alpha = -1;
   double beta = 1;
   double A[] = { -0.786, 0.87, 0.222, -0.043 };
   int lda = 2;
   double B[] = { -0.503, -0.526 };
   int ldb = 1;
   double C[] = { -0.027, -0.391 };
   int ldc = 1;
   double C_expected[] = { -0.305586, -0.301952 };
   cblas_dsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], dbleps, "dsymm(case 1529)");
     }
   };
  };

  {
   int order = 101;
   int side = 141;
   int uplo = 122;
   int M = 1;
   int N = 2;
   double alpha = 0.1;
   double beta = 0.1;
   double A[] = { -0.468 };
   int lda = 1;
   double B[] = { -0.881, 0.692 };
   int ldb = 2;
   double C[] = { -0.812, -0.395 };
   int ldc = 2;
   double C_expected[] = { -0.0399692, -0.0718856 };
   cblas_dsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], dbleps, "dsymm(case 1530)");
     }
   };
  };

  {
   int order = 102;
   int side = 141;
   int uplo = 122;
   int M = 1;
   int N = 2;
   double alpha = 0.1;
   double beta = 0.1;
   double A[] = { 0.849 };
   int lda = 1;
   double B[] = { -0.887, 0.518 };
   int ldb = 1;
   double C[] = { 0.414, -0.251 };
   int ldc = 1;
   double C_expected[] = { -0.0339063, 0.0188782 };
   cblas_dsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], dbleps, "dsymm(case 1531)");
     }
   };
  };

  {
   int order = 101;
   int side = 142;
   int uplo = 122;
   int M = 1;
   int N = 2;
   double alpha = -1;
   double beta = 1;
   double A[] = { 0.457, 0.624, 0.807, 0.349 };
   int lda = 2;
   double B[] = { -0.609, 0.03 };
   int ldb = 2;
   double C[] = { 0.719, -0.624 };
   int ldc = 2;
   double C_expected[] = { 0.973103, -0.143007 };
   cblas_dsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], dbleps, "dsymm(case 1532)");
     }
   };
  };

  {
   int order = 102;
   int side = 142;
   int uplo = 122;
   int M = 1;
   int N = 2;
   double alpha = -1;
   double beta = 1;
   double A[] = { -0.133, -0.117, -0.163, 0.795 };
   int lda = 2;
   double B[] = { -0.882, 0.549 };
   int ldb = 1;
   double C[] = { 0.715, -0.327 };
   int ldc = 1;
   double C_expected[] = { 0.661927, -0.866649 };
   cblas_dsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[i], C_expected[i], dbleps, "dsymm(case 1533)");
     }
   };
  };

  {
   int order = 101;
   int side = 141;
   int uplo = 121;
   int M = 1;
   int N = 2;
   float alpha[2] = {-1.0f, 0.0f};
   float beta[2] = {1.0f, 0.0f};
   float A[] = { 0.476f, 0.816f };
   int lda = 1;
   float B[] = { 0.282f, 0.852f, -0.891f, -0.588f };
   int ldb = 2;
   float C[] = { 0.9f, 0.486f, -0.78f, -0.637f };
   int ldc = 2;
   float C_expected[] = { 1.461f, -0.149664f, -0.835692f, 0.369944f };
   cblas_csymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], flteps, "csymm(case 1534) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], flteps, "csymm(case 1534) imag");
     };
   };
  };

  {
   int order = 102;
   int side = 141;
   int uplo = 121;
   int M = 1;
   int N = 2;
   float alpha[2] = {-1.0f, 0.0f};
   float beta[2] = {1.0f, 0.0f};
   float A[] = { 0.048f, 0.172f };
   int lda = 1;
   float B[] = { 0.786f, 0.783f, 0.809f, -0.569f };
   int ldb = 1;
   float C[] = { -0.227f, -0.215f, 0.881f, 0.233f };
   int ldc = 1;
   float C_expected[] = { -0.130052f, -0.387776f, 0.7443f, 0.121164f };
   cblas_csymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], flteps, "csymm(case 1535) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], flteps, "csymm(case 1535) imag");
     };
   };
  };

  {
   int order = 101;
   int side = 142;
   int uplo = 121;
   int M = 1;
   int N = 2;
   float alpha[2] = {0.0f, 1.0f};
   float beta[2] = {0.0f, 1.0f};
   float A[] = { -0.495f, -0.012f, 0.843f, -0.986f, -0.243f, 0.833f, 0.921f, 0.004f };
   int lda = 2;
   float B[] = { 0.876f, 0.612f, 0.805f, -0.57f };
   int ldb = 2;
   float C[] = { 0.938f, -0.24f, -0.874f, -0.062f };
   int ldc = 2;
   float C_expected[] = { 1.82769f, 0.628319f, 0.93157f, 1.21158f };
   cblas_csymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], flteps, "csymm(case 1536) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], flteps, "csymm(case 1536) imag");
     };
   };
  };

  {
   int order = 102;
   int side = 142;
   int uplo = 121;
   int M = 1;
   int N = 2;
   float alpha[2] = {0.0f, 1.0f};
   float beta[2] = {0.0f, 1.0f};
   float A[] = { -0.812f, 0.83f, 0.705f, 0.15f, -0.463f, 0.901f, -0.547f, -0.483f };
   int lda = 2;
   float B[] = { -0.808f, -0.664f, 0.352f, -0.102f };
   int ldb = 1;
   float C[] = { -0.64f, 0.399f, 0.896f, -0.163f };
   int ldc = 1;
   float C_expected[] = { -0.631906f, 0.496142f, 0.697798f, 1.62656f };
   cblas_csymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], flteps, "csymm(case 1537) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], flteps, "csymm(case 1537) imag");
     };
   };
  };

  {
   int order = 101;
   int side = 141;
   int uplo = 122;
   int M = 1;
   int N = 2;
   float alpha[2] = {-1.0f, 0.0f};
   float beta[2] = {0.0f, 1.0f};
   float A[] = { 0.342f, -0.906f };
   int lda = 1;
   float B[] = { 0.676f, 0.863f, -0.517f, -0.138f };
   int ldb = 2;
   float C[] = { 0.274f, 0.388f, -0.271f, 0.205f };
   int ldc = 2;
   float C_expected[] = { -1.40107f, 0.59131f, 0.096842f, -0.692206f };
   cblas_csymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], flteps, "csymm(case 1538) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], flteps, "csymm(case 1538) imag");
     };
   };
  };

  {
   int order = 102;
   int side = 141;
   int uplo = 122;
   int M = 1;
   int N = 2;
   float alpha[2] = {-1.0f, 0.0f};
   float beta[2] = {0.0f, 1.0f};
   float A[] = { 0.418f, 0.354f };
   int lda = 1;
   float B[] = { -0.74f, 0.018f, 0.395f, 0.248f };
   int ldb = 1;
   float C[] = { -0.162f, 0.175f, -0.853f, 0.652f };
   int ldc = 1;
   float C_expected[] = { 0.140692f, 0.092436f, -0.729318f, -1.09649f };
   cblas_csymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], flteps, "csymm(case 1539) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], flteps, "csymm(case 1539) imag");
     };
   };
  };

  {
   int order = 101;
   int side = 142;
   int uplo = 122;
   int M = 1;
   int N = 2;
   float alpha[2] = {-0.3f, 0.1f};
   float beta[2] = {0.0f, 0.1f};
   float A[] = { 0.12f, 0.496f, 0.313f, -0.136f, 0.987f, 0.532f, 0.58f, -0.687f };
   int lda = 2;
   float B[] = { -0.587f, 0.278f, 0.857f, 0.136f };
   int ldb = 2;
   float C[] = { 0.162f, 0.249f, -0.665f, 0.456f };
   int ldc = 2;
   float C_expected[] = { -0.22769f, -0.0269913f, 0.0502096f, 0.0841558f };
   cblas_csymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], flteps, "csymm(case 1540) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], flteps, "csymm(case 1540) imag");
     };
   };
  };

  {
   int order = 102;
   int side = 142;
   int uplo = 122;
   int M = 1;
   int N = 2;
   float alpha[2] = {-0.3f, 0.1f};
   float beta[2] = {0.0f, 0.1f};
   float A[] = { 0.579f, -0.859f, 0.192f, -0.737f, 0.396f, -0.498f, 0.751f, -0.379f };
   int lda = 2;
   float B[] = { 0.84f, -0.755f, -0.019f, -0.063f };
   int ldb = 1;
   float C[] = { 0.04f, 0.639f, -0.876f, -0.778f };
   int ldc = 1;
   float C_expected[] = { 0.115459f, 0.329813f, 0.288206f, 0.110315f };
   cblas_csymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], flteps, "csymm(case 1541) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], flteps, "csymm(case 1541) imag");
     };
   };
  };

  {
   int order = 101;
   int side = 141;
   int uplo = 121;
   int M = 1;
   int N = 2;
   double alpha[2] = {0, 0};
   double beta[2] = {0, 0};
   double A[] = { 0.511, -0.486 };
   int lda = 1;
   double B[] = { 0.985, -0.923, -0.234, -0.756 };
   int ldb = 2;
   double C[] = { -0.16, 0.049, 0.618, -0.349 };
   int ldc = 2;
   double C_expected[] = { 0.0, 0.0, 0.0, 0.0 };
   cblas_zsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], dbleps, "zsymm(case 1542) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], dbleps, "zsymm(case 1542) imag");
     };
   };
  };

  {
   int order = 102;
   int side = 141;
   int uplo = 121;
   int M = 1;
   int N = 2;
   double alpha[2] = {0, 0};
   double beta[2] = {0, 0};
   double A[] = { 0.46, -0.816 };
   int lda = 1;
   double B[] = { 0.404, 0.113, -0.904, -0.627 };
   int ldb = 1;
   double C[] = { 0.114, 0.318, 0.636, -0.839 };
   int ldc = 1;
   double C_expected[] = { 0.0, 0.0, 0.0, 0.0 };
   cblas_zsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], dbleps, "zsymm(case 1543) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], dbleps, "zsymm(case 1543) imag");
     };
   };
  };

  {
   int order = 101;
   int side = 142;
   int uplo = 121;
   int M = 1;
   int N = 2;
   double alpha[2] = {-1, 0};
   double beta[2] = {-0.3, 0.1};
   double A[] = { -0.835, 0.344, 0.975, 0.634, 0.312, -0.659, -0.624, -0.175 };
   int lda = 2;
   double B[] = { -0.707, -0.846, 0.825, -0.661 };
   int ldb = 2;
   double C[] = { 0.352, -0.499, 0.267, 0.548 };
   int ldc = 2;
   double C_expected[] = { -2.160518, -0.156877, 0.648536, 0.867299 };
   cblas_zsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], dbleps, "zsymm(case 1544) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], dbleps, "zsymm(case 1544) imag");
     };
   };
  };

  {
   int order = 102;
   int side = 142;
   int uplo = 121;
   int M = 1;
   int N = 2;
   double alpha[2] = {-1, 0};
   double beta[2] = {-0.3, 0.1};
   double A[] = { -0.409, 0.013, -0.308, -0.317, -0.535, -0.697, -0.385, 0.119 };
   int lda = 2;
   double B[] = { 0.299, -0.233, 0.093, 0.664 };
   int ldb = 1;
   double C[] = { 0.699, 0.47, -0.347, -0.182 };
   int ldc = 1;
   double C_expected[] = { -0.550491, 0.249777, 0.559487, 0.348221 };
   cblas_zsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], dbleps, "zsymm(case 1545) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], dbleps, "zsymm(case 1545) imag");
     };
   };
  };

  {
   int order = 101;
   int side = 141;
   int uplo = 122;
   int M = 1;
   int N = 2;
   double alpha[2] = {1, 0};
   double beta[2] = {0, 1};
   double A[] = { -0.151, 0.635 };
   int lda = 1;
   double B[] = { 0.711, -0.869, 0.153, 0.647 };
   int ldb = 2;
   double C[] = { -0.299, 0.43, -0.307, 0.133 };
   int ldc = 2;
   double C_expected[] = { 0.014454, 0.283704, -0.566948, -0.307542 };
   cblas_zsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], dbleps, "zsymm(case 1546) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], dbleps, "zsymm(case 1546) imag");
     };
   };
  };

  {
   int order = 102;
   int side = 141;
   int uplo = 122;
   int M = 1;
   int N = 2;
   double alpha[2] = {1, 0};
   double beta[2] = {0, 1};
   double A[] = { 0.793, -0.543 };
   int lda = 1;
   double B[] = { 0.054, -0.045, 0.989, 0.453 };
   int ldb = 1;
   double C[] = { 0.443, -0.641, -0.809, -0.83 };
   int ldc = 1;
   double C_expected[] = { 0.659387, 0.377993, 1.860256, -0.986798 };
   cblas_zsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], dbleps, "zsymm(case 1547) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], dbleps, "zsymm(case 1547) imag");
     };
   };
  };

  {
   int order = 101;
   int side = 142;
   int uplo = 122;
   int M = 1;
   int N = 2;
   double alpha[2] = {1, 0};
   double beta[2] = {-1, 0};
   double A[] = { -0.432, -0.293, -0.819, 0.44, -0.818, -0.258, -0.836, 0.683 };
   int lda = 2;
   double B[] = { -0.259, -0.878, 0.161, 0.744 };
   int ldb = 2;
   double C[] = { 0.436, -0.655, -0.61, -0.875 };
   int ldc = 2;
   double C_expected[] = { -0.521112, 0.460053, -0.04741, 1.148005 };
   cblas_zsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], dbleps, "zsymm(case 1548) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], dbleps, "zsymm(case 1548) imag");
     };
   };
  };

  {
   int order = 102;
   int side = 142;
   int uplo = 122;
   int M = 1;
   int N = 2;
   double alpha[2] = {1, 0};
   double beta[2] = {-1, 0};
   double A[] = { -0.656, 0.378, -0.688, 0.676, 0.967, -0.804, 0.455, -0.425 };
   int lda = 2;
   double B[] = { 0.791, -0.947, -0.945, -0.444 };
   int ldb = 1;
   double C[] = { 0.014, -0.814, -0.091, -0.417 };
   int ldc = 1;
   double C_expected[] = { 0.775374, 1.400882, -0.431711, 1.802857 };
   cblas_zsymm(order, side, uplo, M, N, alpha, A, lda, B, ldb, beta, C, ldc);
   {
     int i;
     for (i = 0; i < 2; i++) {
       gsl_test_rel(C[2*i], C_expected[2*i], dbleps, "zsymm(case 1549) real");
       gsl_test_rel(C[2*i+1], C_expected[2*i+1], dbleps, "zsymm(case 1549) imag");
     };
   };
  };

}

max_stars_repo_name: utdsimmons/ohpc

max_issues_repo_name: utdsimmons/ohpc

max_forks_repo_name: utdsimmons/ohpc


text:
//
// Author: Valerio Bertone: valerio.bertone@cern.ch
//

#pragma once

#include <string>
#include <vector>
#include <utility>

#include <apfel/apfelxx.h>
#include <yaml-cpp/yaml.h>
#include <gsl/gsl_rng.h>

namespace NangaParbat
{
  /**
   * @brief The "DataHandler" class provides a common interface to all
   * datasets. It provides methods to get kinematics, central values,
   * uncertainties, etc.
   */
  class DataHandler
  {
  public:

    /**
     * @brief The process enumerator
     */
    enum Process: int {UnknownProcess = -1, DY = 0, SIDIS = 1, SIA = 2, DIA = 3};

    /**
     * @brief The observable enumerator
     */
    enum Observable: int {UnknownObservable = -1, dsigma_dxdydz = 0, dsigma_dxdQdz = 1, multiplicity = 2};

    /**
     * @brief Structure containing the kinematic information of one
     * single data set.
     */
    struct Kinematics
    {
      Kinematics();
      bool empty() const;
      int                                    ndata;    //!< Number of data points
      double                                 Vs;       //!< Center of mass energy
      std::vector<double>                    qTv;      //!< Vector of qT values
      std::vector<std::pair<double, double>> qTmap;    //!< Map of qT bounds to associate to the single bins
      std::vector<double>                    qTfact;   //!< Possible bin-by-bin prefactors to multiply the theoretical predictions
      std::pair<double, double>              var1b;    //!< Variable 1 integration bounds
      std::pair<double, double>              var2b;    //!< Variable 2 integration bounds
      std::pair<double, double>              var3b;    //!< Variable 3 integration bounds
      bool                                   IntqT;    //!< Whether the bins in qTv are integrated over
      bool                                   Intv1;    //!< Whether the bins variable 1 are integrated over
      bool                                   Intv2;    //!< Whether the bins variable 2 are integrated over
      bool                                   Intv3;    //!< Whether the bins variable 3 are integrated over
      bool                                   PSRed;    //!< Whether there is a final-state PS reduction
      double                                 pTMin;    //!< Minimum pT of the final-state leptons
      std::pair<double, double>              etaRange; //!< Allowed range in eta of the final-state leptons
    };

    /**
     * @brief Structure containing the single bin information. This is
     * currently used only for the FF_SIDIS project.
     * @todo Integrate it better in the rest of the class.
     */
    struct Binning
    {
      Binning();
      double zmin;
      double zmax;
      double zav;
      bool Intz;
      double xmin;
      double xmax;
      double xav;
      bool Intx;
      double Qmin;
      double Qmax;
      double Qav;
      bool IntQ;
      double ymin;
      double ymax;
      double yav;
      bool Inty;
    };

    /**
     * @brief The "DataHandler" copy constructor.
     */
    DataHandler(DataHandler const &DH);

    /**
     * @brief The "DataHandler" constructor.
     * @param name: the name associated to the data set
     * @param datafile: the YAML:Node with the interpolation table
     * @param rng: GSL random number object
     * @param fluctuation: ID of the fluctuation (i.e. Monte-Carlo replica ID) (default: 0, i.e. no fluctuations)
     * @param t0: vector of predictions to be used for the t0-prescription
     */
    DataHandler(std::string const& name, YAML::Node const& datafile, gsl_rng* rng = nullptr, int const& fluctuation = 0, std::vector<double> const& t0 = {});

    /**
     * @brief Function that fluctuates data
     * @param rng: GSL random number object
     * @param fluctuation: ID of the fluctuation (i.e. Monte-Carlo replica ID) (default: 0, i.e. no fluctuations)
     */
    void FluctuateData(gsl_rng *rng, int const &fluctuation);

    /**
     * @brief Function that sets the data central values replacing that
     * introduced in the constructor.
     * @param means: the new means
     */
    void SetMeans(std::vector<double> const& means, gsl_rng* rng = nullptr, int const& fluctuation = 0);

    /**
     * @brief Function that returns the name of the dataset
     */
    std::string GetName() const { return _name; };

    /**
     * @brief Function that returns the datafile in YAML format
     */
    YAML::Node GetDataFile() const { return _datafile; };

    /**
     * @brief Function that returns the process code
     */
    Process GetProcess() const { return _proc; };

    /**
     * @brief Function that returns the observable code
     */
    Observable GetObservable() const { return _obs; };

    /**
     * @brief Function that returns the target isoscalarity
     * @note The code always assumes that one of the hadrons has
     * isoscalarity 1, meaning that it's a single hadron whose
     * distributions don't need to be manipulated.
     */
    double GetTargetIsoscalarity() const { return _targetiso; };

    /**
     * @brief Function that returns the possible identified hadron
     * species in the final state.
     */
    std::string GetHadron() const { return _hadron; };

    /**
     * @brief Function that returns the charge of the identified final
     * state.
     */
    int GetCharge() const { return _charge; };

    /**
     * @brief Function that returns the quark-tagged compoments. Zero
     * corresponds to total.
     */
    std::vector<apfel::QuarkFlavour> GetTagging() const { return _tagging; };

    /**
     * @brief Function that returns any possible constant prefactor to
     * be used to multiply the theoretical predictions.
     */
    double GetPrefactor() const { return _prefact; };

    /**
     * @brief Function that returns the kinematic object
     */
    Kinematics GetKinematics() const { return _kin; };

    /**
     * @brief Function that returns the mean values
     */
    std::vector<double> GetMeanValues() const { return _means; };

    /**
     * @brief Function that returns the fluctuated data
     */
    std::vector<double> GetFluctutatedData() const { return _fluctuations; };

    /**
     * @brief Function that returns the sum in quadrature of the
     * uncorrelated uncertainties.
     */
    std::vector<double> GetUncorrelatedUnc() const { return _uncor; };

    /**
     * @brief Function that returns the additive correlated systematic
     * uncertainties.
     */
    std::vector<std::vector<double>> GetAddCorrelatedUnc() const { return _corra; };

    /**
     * @brief Function that returns the multiplicative correlated
     * systematic uncertainties.
     */
    std::vector<std::vector<double>> GetMultCorrelatedUnc() const { return _corrm; };

    /**
     * @brief Function that returns the all the correlated systematic
     * uncertainties (additive first and multiplicative second).
     */
    std::vector<std::vector<double>> GetCorrelatedUnc() const { return _corr; };

    /**
     * @brief Function that returns the covariance matrix of the
     * correlated uncertainties.
     */
    apfel::matrix<double> GetCovarianceMatrix() const { return _covmat; };

    /**
     * @brief Function that returns the Cholesky decomposition of the
     * covariance matrix.
     */
    apfel::matrix<double> GetCholeskyDecomposition() const { return _CholL; };

    /**
     * @brief Function that returns the set of t0 predictions
     */
    std::vector<double> GetT0() const { return _t0; };

    /**
     * @brief Function that returns the plotting labels.
     */
    std::map<std::string, std::string> GetLabels() const { return _labels; };

    /**
     * @brief Get vector of bins. This is currently used only for the
     * FF_SIDIS project.
     * @todo Integrate it better in the rest of the
     * class.
     */
    std::vector<Binning> GetBinning() const { return _bins; }

  protected:

    std::string                        _name;         //!< Name of the dataset
    YAML::Node                         _datafile;     //!< Datafile in YAML
    Process                            _proc;         //!< The process
    Observable                         _obs;          //!< The observable
    double                             _targetiso;    //!< Isoscalarity of the target
    std::string                        _hadron;       //!< Hadron species identified in the final state
    double                             _charge;       //!< Charge of the identified final state
    std::vector<apfel::QuarkFlavour>   _tagging;      //!< Possible quark-tagged components
    double                             _prefact;      //!< Possible overall prefactor to multiply the theoretical predictions
    Kinematics                         _kin;          //!< Kinematics block
    std::vector<double>                _means;        //!< Vector of central values
    std::vector<double>                _uncor;        //!< Vector of uncorrelated uncertainties
    std::vector<std::vector<double>>   _corra;        //!< Additive correlated uncertainties
    std::vector<std::vector<double>>   _corrm;        //!< Multiplicative correlated uncertainties
    std::vector<std::vector<double>>   _corr;         //!< All correlated uncertainties
    apfel::matrix<double>              _covmat;       //!< Covariance matrix
    apfel::matrix<double>              _CholL;        //!< Cholesky decomposition of the covariance matrix
    std::map<std::string, std::string> _labels;       //!< Labels used for plotting
    std::vector<double>                _fluctuations; //!< Vector of fluctuated data
    std::vector<double>                _t0;           //!< Vector of t0-predictions
    std::vector<Binning>               _bins;         //!< Vector of bins (currently used only for the FF_SIDIS project)

    friend std::ostream& operator << (std::ostream& os, DataHandler const& DH);
  };

  std::ostream& operator << (std::ostream &os, DataHandler const& DH);
}

ext: h

max_stars_repo_name: vbertone/NangaParbat

max_issues_repo_name: vbertone/NangaParbat

max_forks_repo_name: vbertone/NangaParbat


text:
// -*- C++ -*-  Copyright (c) Microsoft Corporation; see license.txt
#ifndef MESH_PROCESSING_LIBHH_MY_LAPACK_H_
#define MESH_PROCESSING_LIBHH_MY_LAPACK_H_
#include "libHh/Hh.h"  // HH_REFERENCE_LIB()

#if defined(HH_HAVE_LAPACK)

#if defined(HH_USE_LAPACK_INTEGER)  // Google

#include <lapack.h>
using lapack_int = lapack::integer;

#elif !(defined(_WIN32) || defined(__CYGWIN__))  // unix

#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wredundant-decls"
#endif
#include <lapacke.h>  // in either /usr/include/ or /usr/include/lapacke/

#else  // cygwin or WIN32

#if defined(__CYGWIN__)

// cygwin: c:/cygwin/usr/src/lapack-3.5.0.tgz
//  lapacke_config.h
// #ifndef lapack_int
// #if defined(LAPACK_ILP64)
// #define lapack_int long
// #else
// #define lapack_int int
// #endif
// #endif
//
//  lapacke.h:  "#define lapack_int int"
// #define LAPACK_sgelss LAPACK_GLOBAL(sgelss, SGELSS)
// void LAPACK_sgelss( lapack_int* m, lapack_int* n, lapack_int* nrhs, float* a,
//                     lapack_int* lda, float* b, lapack_int* ldb, float* s,
//                     float* rcond, lapack_int* rank, float* work,
//                     lapack_int* lwork, lapack_int* info );

//  c:/cygwin/usr/src/lapack-3.5.0.tgz!lapack-3.5.0/lapacke/example/example_DGELS_colmajor.c
// #include <lapacke.h>
// {
//    double A[5][3] = {1, 2, 3, 4, 5, 1, 3, 5, 2, 4, 1, 4, 2, 5, 3};
//    double b[5][2] = {-10, 12, 14, 16, 18, -3, 14, 12, 16, 16};
//    lapack_int m = 5, n = 3, lda = 5, ldb = 5, nrhs = 2;
//    lapack_int info = LAPACKE_dgels(LAPACK_COL_MAJOR, 'N', m, n, nrhs, *A, lda, *b, ldb);
// }

using lapack_int = int;

#else  // _WIN32

using lapack_int = long;  // was defined as "integer" in f2c.h

#endif

// Continue: cygwin or WIN32

// clapack routines in liblapack
extern "C" {

// http://www.netlib.org/lapack/explore-html/d0/db8/group__real_g_esolve.html#ga206e3084597d088b31dc054a69aec93f
// SGELSS solves overdetermined or underdetermined systems for GE matrices, using SVD.
// ~/git/lib_src/CLAPACK/SRC/sgelss.c
lapack_int sgelss_(lapack_int* m, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* b,
                   lapack_int* ldb, float* s, float* rcond, lapack_int* irank, float* work, lapack_int* lwork,
                   lapack_int* info);

// same for double-precision
lapack_int dgelss_(lapack_int* m, lapack_int* n, lapack_int* nrhs, double* a, lapack_int* lda, double* b,
                   lapack_int* ldb, double* s, double* rcond, lapack_int* irank, double* work, lapack_int* lwork,
                   lapack_int* info);

// http://www.netlib.org/lapack/explore-html/d0/d2a/sgelsx_8f.html
// SGELSX solves overdetermined or underdetermined systems for GE matrices, using QR.
// This routine is deprecated and has been replaced by routine SGELSY.
// ~/git/lib_src/CLAPACK/SRC/sgelsx.c
// lapack_int sgelsx_(lapack_int* m, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda,
//                   float* b, lapack_int* ldb, lapack_int* jpvt, float* rcond, lapack_int* irank,
//                   float* work, lapack_int* info);

// http://www.netlib.org/lapack/explore-html/dc/db6/sgelsy_8f.html
lapack_int sgelsy_(lapack_int* m, lapack_int* n, lapack_int* nrhs, float* a, lapack_int* lda, float* b,
                   lapack_int* ldb, lapack_int* jpvt, float* rcond, lapack_int* irank, float* work, lapack_int* lwork,
                   lapack_int* info);

// http://www.netlib.org/lapack/explore-html/d4/dca/group__real_g_esing.html
// subroutine SGESVD (JOBU, JOBVT, M, N, A, LDA, S, U, LDU, VT, LDVT, WORK, LWORK, INFO)
// SGESVD computes the singular value decomposition (SVD) for GE matrices
// ~/git/lib_src/CLAPACK/SRC/sgesvd.c
lapack_int sgesvd_(char* jobu, char* jobvt, lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* s,
                   float* u, lapack_int* ldu, float* vt, lapack_int* ldvt, float* work, lapack_int* lwork,
                   lapack_int* info);

// http://www.netlib.org/lapack/explore-html/d8/ddc/group__real_g_ecomputational.html#ga7cb54fa1727bf0166523036f4948bc56
// subroutine SGEQRF (M, N, A, LDA, TAU, WORK, LWORK, INFO)
// SGEQRF computes a QR factorization of a real M-by-N matrix A:
// A = Q * R.
// ~/git/lib_src/CLAPACK/SRC/sgeqrf.c
lapack_int sgeqrf_(lapack_int* m, lapack_int* n, float* a, lapack_int* lda, float* tau, float* work, lapack_int* lwork,
                   lapack_int* info);
}

#if defined(_MSC_VER)
HH_REFERENCE_LIB("liblapack.lib");
HH_REFERENCE_LIB("libBLAS.lib");
#if 1
HH_REFERENCE_LIB("libf2c.lib");  // CLAPACK
#else
HH_REFERENCE_LIB("libF77.lib");  // liblapack
HH_REFERENCE_LIB("libI77.lib");
#endif
#endif  // defined(_MSC_VER)

#endif  // !(defined(_WIN32) || defined(__CYGWIN__))

#endif  // defined(HAVE_LAPACK)

#endif  // MESH_PROCESSING_LIBHH_MY_LAPACK_H_

max_stars_repo_name: hhoppe/Mesh-processing-library

max_issues_repo_name: wangxihao/Mesh-processing-library

max_forks_repo_name: wangxihao/Mesh-processing-library


text:
#ifndef EXECUTION_CONTENT_INCLUDE
#define EXECUTION_CONTENT_INCLUDE

#include <atomic>
#include <map>
#include <string>
#include <thread>
#include <vector>

#include <boost/asio.hpp>
#include <boost/serialization/map.hpp>
#include <boost/serialization/vector.hpp>
#include <gsl/gsl>

#include "base-utils/commandUtils.h"
#include "base-utils/execution.h"
#include "base-utils/tmpFile.h"

namespace execHelper {
namespace test {
namespace baseUtils {
class IoService {
  public:
    IoService() = default;
    IoService(const IoService& other) = delete;
    IoService(IoService&& other) = delete;
    ~IoService() noexcept;

    IoService& operator=(const IoService& other) = delete;
    IoService& operator=(IoService&& other) = delete;

    void start() noexcept;
    void stop() noexcept;
    void run() noexcept;

    boost::asio::io_service& get() noexcept;

  private:
    boost::asio::io_context m_service;
    std::atomic<bool> m_isRunning = {false};
    std::thread m_thread;
};

struct ExecutionContentData {
    std::vector<std::string> args;
    std::map<std::string, std::string> env;

    template <typename Archive>
    void serialize(Archive& ar, const unsigned int /*version*/) {
        ar& args& env;
    }
};

struct ExecutionContentDataReply {
    ReturnCode returnCode;

    ExecutionContentDataReply(ReturnCode returnCode) noexcept
        : returnCode(returnCode) {
        ;
    }
};

class ExecutionContentServer {
  public:
    using ConfigCommand = std::vector<std::string>;

    ExecutionContentServer(ReturnCode returnCode) noexcept;
    ~ExecutionContentServer() noexcept;

    ExecutionContentServer(const ExecutionContentServer& other) = delete;
    ExecutionContentServer(ExecutionContentServer&& other) noexcept;

    ExecutionContentServer&
    operator=(const ExecutionContentServer& other) = delete;
    ExecutionContentServer& operator=(ExecutionContentServer&& other) noexcept;

    void swap(ExecutionContentServer& other) noexcept;

    ConfigCommand getConfigCommand() const noexcept;
    unsigned int getNumberOfExecutions() const noexcept;
    const std::vector<ExecutionContentData>& getReceivedData() const noexcept;

    void clear() noexcept;

    static void registerIoService(gsl::not_null<IoService*> ioService) noexcept;

  private:
    /**
     * Opens the acceptor explicitly rather than using the appropriate constructor for it. This is to work around
     * the fact that the appropriate constructor will throw, causing an exception to leak out of the interface
     *
     * \throws boost::system::system_error  If the acceptor can not be opened
     */
    void openAcceptor();
    void init() noexcept;
    void accept() noexcept;
    ExecutionContentDataReply addData(ExecutionContentData data) noexcept;

    std::vector<ExecutionContentData> m_receivedData;
    uint32_t m_numberOfExecutions = {0};
    ReturnCode m_returnCode = {SUCCESS};
    TmpFile m_file;
    boost::asio::local::stream_protocol::endpoint m_endpoint;
    boost::asio::local::stream_protocol::socket m_socket;
    boost::asio::local::stream_protocol::acceptor m_acceptor;

    static IoService* m_ioService;
};
using ExecutionContent = ExecutionContentServer;

class ExecutionContentClient {
  public:
    ExecutionContentClient(const Path& file);

    ReturnCode addExecution(const ExecutionContentData& data);

  private:
    boost::asio::local::stream_protocol::endpoint m_endpoint;
};
} // namespace baseUtils
} // namespace test
} // namespace execHelper

#endif /* EXECUTION_CONTENT_INCLUDE */

max_stars_repo_name: exec-helper/source

max_issues_repo_name: exec-helper/source

max_forks_repo_name: exec-helper/source


text:
#ifndef API_H_INCLUDED
#define API_H_INCLUDED

#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_complex.h>
#include <plplot/plplot.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "stack.h"
#include "utf8.h"
#include "gdate.h"
#include <setjmp.h>

#if defined(_MSC_VER) || defined(_WIN32)
#include <Windows.h>
#endif

#define RECORD_SEP '~'

// Parse errors
#define KEE_UNQU    0x01 // unmatched quotation marks
#define KEE_UNLP    0x02 // unmatched left parentheses
#define KEE_UNRP    0x04 // unmatched right parentheses
#define KEE_UNOP    0x08 // unknown operators
#define KEE_FUNC    0x10 // wrong function syntax
#define KEE_ARG     0x20
#define KEE_NUM     0x40 // fail to parse a number
//#define KEE_END     0x80 // fail to parse a number

// Evaluation errors
#define KEE_UNFUNC  0x40 // undefined function
#define KEE_UNVAR   0x80 // unassigned variable

// Return type
#define KEV_REAL 1
#define KEV_INT  2
#define KEV_STR  3
#define KEV_VEC  4
#define KEV_MAT  5
#define KEV_COMPLEX 6
#define KEV_FNC  7
#define KEV_REC  8
#define KEV_VEC_INT  9
#define KEV_DEF  10
#define KEV_IMAGE 11
#define KEV_FILE 12
#define KEV_BUFFER 13
#define KEV_DATE 14
#define KEV_PTR   15
#define KEV_FPOS  16

#define KEV_REAL_S "REAL"
#define KEV_INT_S "INT"
#define KEV_STR_S "STR"
#define KEV_VEC_S  "VEC"
#define KEV_MAT_S  "MAT"
#define KEV_COMPLEX_S "COMPLEX"
#define KEV_CMD_S  "CMD"
#define KEV_FNC_S  "FNC"
#define KEV_REC_S  "REC"
#define KEV_VEC_INT_S  "VEC_INT"
#define KEV_DEF_S  "DEF"
#define KEV_IMAGE_S "IMAGE"
#define KEV_FILE_S "FILE"
#define KEV_BUFFER_S "BUFFER"
#define KEV_DATE_S "DATE"
#define KEV_PTR_S  "PTR"
#define KEV_FPOS_S  "FPOS"

extern char * kev_to_str[17];

#define KEO_NULL  0
#define KEO_POS   1
#define KEO_NEG   2
#define KEO_BNOT  3
#define KEO_LNOT  4
#define KEO_POW   5
#define KEO_MUL   6
#define KEO_DIV   7
#define KEO_IDIV  8
#define KEO_MOD   9
#define KEO_ADD  10
#define KEO_SUB  11
#define KEO_LSH  12
#define KEO_RSH  13
#define KEO_LT   14
#define KEO_LE   15
#define KEO_GT   16
#define KEO_GE   17
#define KEO_EQ   18
#define KEO_NE   19
#define KEO_BAND 20
#define KEO_BXOR 21
#define KEO_BOR  22
#define KEO_LAND 23
#define KEO_LOR  24
#define KEO_LET  25
#define KEO_NOP  26

#define KEO_MAX  27

#define KET_NULL  0
#define KET_DEFNAME 1
#define KET_CMD   2
#define KET_VCMD  3
#define KET_OP    4
#define KET_FUNC  5
#define KET_REC   6
#define KET_XPROP 7
#define KET_PROP  8
#define KET_VAL_SEP 10
#define KET_CONST 11
#define KET_VAL   12
#define KET_FILE  13
#define KET_XNAME 14 //already set when it's VNAME
#define KET_VNAME 15

#define KEF_NULL  0
#define KEF_REAL  1
#define KEF_LET   2
#define KEF_GET   3

#include "kdq.h"
#include "khash.h"

struct token_s;
struct kexpr_s;
struct sml_s;

typedef char* strptr;
typedef struct token_s* ke1_p;
typedef int(*cmdp)(struct sml_s * sml, int);
typedef void(*fncp)(struct sml_s *);
typedef int(*vcmdp)(struct sml_s * sml, int);
typedef int(__cdecl *dllke_hash_add_t)(struct sml_s *, fncp, char *);
typedef struct token_s *(__cdecl *dllke_get_out_t)(struct sml_s *);

KHASH_MAP_INIT_STR(0, cmdp)
KHASH_MAP_INIT_STR(1, vcmdp)
KHASH_MAP_INIT_STR(2, int)
KHASH_MAP_INIT_STR(3, int)
KHASH_MAP_INIT_STR(5, fncp)
KHASH_MAP_INIT_STR(6, int)
KHASH_MAP_INIT_STR(7, int)

#pragma warning( push )
#pragma warning( disable : 273)
#pragma warning( disable : 4018)
#pragma warning( disable : 4334)
#pragma warning( disable : 4627)
#pragma warning( disable : 4267)
KDQ_INIT(int)
#pragma warning( pop )

struct sml_s;
typedef struct sml_s {
	int is_execute;
	int topGlobal;
	struct token_s *def_name;      // current def name to put the stack ref
	struct token_s **stack;        // stack for the evaluation of the program
	double *rstack;                    // stack for the evaluation of the program
	struct token_s *out;           // pointer to the array of out parameter to put into the stack
	struct kexpr_s *kexpr;
	struct token_s ** fields;		// array of all global fields of the program to exectue
	struct token_s ** tokens;     // array of pointers of all program tokens
	int top;
	int localtop;				// will be init with gfield_qte;
	int inittop;				// will be init with gfield_qte;
	struct token_s * tokp;
	int out_qte;
	int tok_idx;
	int val;
	jmp_buf env_buffer;
	// GLOBAL VARIABLE USED BY ALL FUNCTIONS
	int field_qte;				// number of local fields, reset for each def
	int gfield_qte;				// number of global fields
	int mem_count;				// current count of memory allocation
								// parser variables
	int isNextDefName;			// flag to indicate that the next token is the def name
	char currentDefName[100];	// current name of the current function
	int sourceCodeLine;			// use to keep the line number to show better error trapping
	int isFirstToken;			// use to remove separators at the beginning of the program
	int isLastTokenNop;			// use to manage the command seperator, the rule is to have one separator between each comand
	char lastErrorMessage[256]; //
	struct token_s * recp[100]; // local record fields
	struct token_s * grecp[100];// global record fields
	int rec_qte;        // number of local record fields
	int grec_qte;        // number of global record fields
	khash_t(5) *hfunction;
	khash_t(6) *hname;  // function name = negative stack
	khash_t(7) *gname;  // global name = positif stack
#if defined(_MSC_VER) || defined(_WIN32)
	HMODULE libhandle[64];
	int libhandle_qte;      // number of global fields
#endif
	kdq_t(int) *callstack;
	kdq_t(int) *hiforcommand;
	kdq_t(int) *hinextcommand;
	khash_t(3) *hidefcommand;
	khash_t(0) *hcommand;
	khash_t(1) *hvcommand;
	kstack_t *harg;
	int g_forstack[20];
	int g_fortop;
	int lastDef;
	dllke_hash_add_t dllke_hash_add;
	dllke_get_out_t dllke_get_out;
} sml_t;

struct kexpr_s;
typedef struct kexpr_s kexpr_t;
typedef int * reclistt;

struct token_s;
typedef struct token_s {
	int64_t i;
	double r;
	union {    //
		void(*builtin)(struct token_s *a, struct token_s *b, struct token_s *out); // execution function
		double(*real_func1)(double);
		double(*real_func2)(double, double);
		int(*defprop)(sml_t* sml, struct token_s* prop, int top);
		void(*deffunc)(sml_t* sml);
		int(*defcmd)(sml_t* sml, int itok);
		int(*defvcmd)(sml_t* sml, int itok);
		struct token_s * recp;
	} f;
	union {  //
		void * ptr;
		struct token_s * tokp;
		char *s;
		char* image;
		char ** ms;
		fpos_t * fpos;
		FILE *file;
		void *buffer;
		GDate_t * date;
		gsl_vector_int * vector_int;
		gsl_vector * vector;
		gsl_matrix * matrix;
		gsl_complex tcomplex;
		reclistt reclist;
		PLGraphicsIn * plgrin;
		PLPointer * plptr;
		PLTRANSFORM_callback pltrcb;
		PLMAPFORM_callback plmpcb;
		PLDEFINED_callback pldefcb;
		PLLABEL_FUNC_callback pllblcb;
		PLFILL_callback plfillcb;
	} obj;
	char *name; // variable name or function name
	int32_t ijmp;
	int32_t sourceLine; // fast jmp
	uint16_t ttype;
	uint16_t vtype;
	int16_t ifield;
	int8_t icmd;
	int8_t assigned;
	int8_t propget;
	int8_t propset;
	int8_t tofree;
	int8_t islocal;
	int8_t op;
	int8_t n_args;
	int8_t realToken;
	int8_t isfor;
} token_t;

struct kexpr_s {
	int n;
	token_t *e;
};

token_t * ke_get_out(sml_t *sml);
void ke_hash_add(sml_t *sml, fncp key, char * name);
void ke_inc_memory(sml_t *sml);
void ke_dec_memory(sml_t *sml);
void * ke_calloc_memory(sml_t *sml, size_t i, size_t x);
void * ke_malloc_memory(sml_t *sml, size_t i);
void ke_free_memory(sml_t *sml, void * m);
void ke_print_one(sml_t *sml, token_t* t);
gsl_matrix * sml_pop_set_matrix(sml_t * sml);
gsl_vector * sml_pop_set_vector(sml_t * sml);
gsl_vector_int * sml_pop_set_vector_int(sml_t * sml);
gsl_matrix * sml_peek_set_matrix(sml_t * sml, int n);
gsl_vector * sml_peek_set_vector(sml_t * sml, int n);
gsl_vector_int * sml_peek_set_vector_int(sml_t * sml, int n);
void * sml_peek_set_ptr(sml_t * sml, int n);

#define __GLOBAL "g_"
#define __GLOBAL_SEP "_"
#define __GLOBAL_DSEP "__"

#define sml_get_top(sml) sml->top
#define sml_dec_top(sml) --sml->top
#define sml_set_top(sml,top) sml->top=top
#define sml_get_stack(sml) sml->stack
#define sml_get_tokp(sml) sml->tokp
#define sml_get_args(sml) sml->tokp->n_args
#define sml_set_args(sml,a) sml->tokp->n_args = a
#define sml_get_ttype(sml) sml->tokp->ttype
#define sml_get_vtype(sml) sml->tokp->vtype
#define sml_get_ijmp(sml) sml->tokp->ijmp
#define sml_get_assigned(sml) sml->tokp->assigned
#define sml_set_assigned(sml,a) sml->tokp->assigned = a

#define sml_pop_token(sml) sml->stack[--sml->top]
#define sml_pop_int(sml) sml->stack[--sml->top]->i
#define sml_pop_real(sml) sml->stack[--sml->top]->r
#define sml_pop_ptr(sml) sml->stack[--sml->top]->obj.ptr
#define sml_pop_file(sml) sml->stack[--sml->top]->obj.file
#define sml_pop_fpos(sml) sml->stack[--sml->top]->obj.fpos
#define sml_pop_str(sml) sml->stack[--sml->top]->obj.s
#define sml_pop_date(sml) sml->stack[--sml->top]->obj.date
#define sml_pop_complex(sml) sml->stack[--sml->top]->obj.tcomplex
#define sml_pop_complex_adr(sml) &sml->stack[--sml->top]->obj.tcomplex
#define sml_pop_day(sml) sml->stack[--sml->top]->i
#define sml_pop_month(sml) sml->stack[--sml->top]->i
#define sml_pop_year(sml) sml->stack[--sml->top]->i
#define sml_pop_matrix(sml) sml->stack[--sml->top]->obj.matrix
#define sml_pop_vector(sml) sml->stack[--sml->top]->obj.vector
#define sml_pop_vector_int(sml) sml->stack[--sml->top]->obj.vector_int

#define sml_peek_token(sml,i) sml->stack[i]
#define sml_peek_int(sml,ii) sml->stack[ii]->i
#define sml_peek_real(sml,i) sml->stack[i]->r
#define sml_peek_ptr(sml,i) sml->stack[i]->obj.ptr
#define sml_peek_file(sml,i) sml->stack[i]->obj.file
#define sml_peek_fpos(sml,i) sml->stack[i]->obj.fpos
#define sml_peek_str(sml,i) sml->stack[i]->obj.s
#define sml_peek_date(sml,i) sml->stack[i]->obj.date
#define sml_peek_complex(sml,i) sml->stack[i]->obj.tcomplex
#define sml_peek_complex_adr(sml,i) &sml->stack[i]->obj.tcomplex
#define sml_peek_day(sml,i) (GDateDay)sml->stack[i]->i
#define sml_peek_month(sml,i) (GDateMonth)sml->stack[i]->i
#define sml_peek_year(sml,i) (GDateYear)sml->stack[i]->i
#define sml_peek_matrix(sml,i) sml->stack[i]->obj.matrix
#define sml_peek_vector(sml,i) sml->stack[i]->obj.vector
#define sml_peek_vector_int(sml,i) sml->stack[i]->obj.vector_int

#define sml_get_complex_adr  &out->obj.tcomplex

#define sml_get_type(t) t->vtype
#define sml_get_str(t) t->obj.s
#define sml_get_real(t) t->r
#define sml_get_int(t) t->i
#define sml_get_ifield(t) t->ifield

#define sml_set_int(sml,t,ii) { int i = t->ifield; \
	if (i < 0) { \
		i += sml->localtop; \
	} \
	t = sml->fields[i]; \
	t->i = ii; }

#define sml_get_ptr(t) t->obj.ptr
#define sml_get_file(t) t->obj.file
#define sml_get_buffer(t) t->obj.buffer
#define sml_get_fpos(t) t->obj.fpos

#define sml_set_fpos(sml,t,fposp) { int i = t->ifield; \
	if (i < 0) { \
		i += sml->localtop; \
	} \
	t = sml->fields[i]; \
	t->obj.fpos = fposp; }

#define sml_set_ptr_null(sml,t) { int i = t->ifield; \
	if (i < 0) { \
		i += sml->localtop; \
	} \
	t = sml->fields[i]; \
	t->obj.ptr = NULL; }

#define sml_get_len(t) t->i
#define sml_adr_str(t) &t->obj.s
#define sml_adr_ptr(t) &t->obj

#define sml_get_matrix(t) t->obj.matrix
#define sml_get_vector(t) t->obj.vector
#define sml_get_vector_int(t) t->obj.vector_int
#define sml_get_complex(t) t->obj.complex

#define sml_push_buffer(sml, b, ii) token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.buffer = b; \
	out->i = ii; \
	out->r == (double)ii; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_BUFFER;

#define sml_push_file(sml, file) token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.file = file; \
	out->i = 1; \
	out->r == 1.0; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_FILE;

#define sml_push_new_complex(sml) token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_COMPLEX;

#define sml_push_complex(sml, z) token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.tcomplex = z; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_COMPLEX;

#define sml_push_real(sml, r) token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->r = r; \
	out->i = (int64_t)r; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_REAL;

#define sml_push_date(sml, dt) token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.date = dt; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_DATE;

#define  sml_push_int(sml, ii) token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->i = ii; \
	out->r = (double)ii; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_INT;

#define  sml_push_ptr(sml, ptr) \
	token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.ptr = ptr; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_PTR;

#define  sml_push_str(sml, str) \
	token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.s = str; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_STR;

#define  sml_push_matrix(sml, m) \
	token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.matrix = m; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_MAT;

#define  sml_push_vector(sml, v) \
	token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.vector = v; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_VEC;

#define  sml_push_vector_int(sml, v) \
	token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.vector_int = v; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_VEC_INT;

#define  sml_push_image(sml, image) \
	token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.image = image; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_IMAGE;

#define  sml_push_fpos(sml, fposp) \
	token_t* out; \
	sml->stack[sml->top] = ke_get_out(sml); \
	out = sml->stack[sml->top++]; \
	out->obj.fpos = fposp; \
	out->ttype = KET_VAL; \
	out->vtype = KEV_FPOS;

#define sml_out_date out->obj.date

#define sml_free_ptr(sml,ptr) ke_free_memory(sml,ptr); ptr = NULL

#define sml_new_ptr(sml,size) ke_calloc_memory(sml, size,1)

#define sml_mem_inc ke_inc_memory

#define sml_save_str(sml, tokp, tmp) \
	int k = tokp->ifield; \
    if (k < 0) \
		k += sml->localtop; \
	tokp = sml->fields[k]; \
	if (tokp->vtype == KEV_STR && tokp->obj.s) { \
		ke_free_memory(sml, tokp->obj.s); \
	} \
	tokp->obj.s = tmp; \
	tokp->i = 0, tokp->r = 0 ; \
	tokp->vtype = KEV_STR;

#endif

#ifdef _DEBUG
#define sml_assert_args(sml,i,fnc) if (sml->tokp->n_args != i) { \
		printf("ASSERT ERROR : Invalid number of parameters, expected <%d> got <%d> at line <%d> for function <%s>", i, sml->tokp->n_args, sml->tokp->sourceLine,fnc);	\
		longjmp(sml->env_buffer, 1); \
	}
#else
#define sml_assert_args(sml,i,s)
#endif

#ifdef _DEBUG
#define sml_assert_args_min(sml,i,fnc) if (sml->tokp->n_args < i) { \
		printf("ASSERT ERROR : Invalid number of parameters, expected at least <%d> got <%d> at line <%d> for function <%s>", i, sml->tokp->n_args, sml->tokp->sourceLine,fnc);	\
		longjmp(sml->env_buffer, 1); \
	}
#else
#define sml_assert_args_min(sml,i,fnc)
#endif

#ifdef _DEBUG
#define sml_assert_type(sml,i,t,fnc) \
	if (sml->stack[sml->top - 1 - (sml->tokp->n_args - i)]->vtype != t) { \
		printf("ASSERT ERROR : Invalid type for parameter #%d, expected <%s> got <%s> at line <%d> for function <%s>", i, kev_to_str[t], kev_to_str[sml->stack[sml->top - 1 - (sml->tokp->n_args - i)]->vtype], sml->tokp->sourceLine,fnc); \
		longjmp(sml->env_buffer, 1); \
	}
#else
#define sml_assert_type(sml,i,t,s)
#endif

#ifdef _DEBUG
#define sml_assert_type_int_or_real(sml,i,fnc) \
	if (sml->stack[sml->top - 1 - (sml->tokp->n_args - i)]->vtype != KEV_INT && sml->stack[sml->top - 1 - (sml->tokp->n_args - i)]->vtype != KEV_REAL) { \
		printf("ASSERT ERROR : Invalid type for parameter #%d, expected <INT OR REAL> got <%s> at line <%d> for function <%s>", i, kev_to_str[sml->stack[sml->top - 1 - (sml->tokp->n_args - i)]->vtype], sml->tokp->sourceLine,fnc); \
		longjmp(sml->env_buffer, 1); \
	}
#else
#define sml_assert_type_int_or_real(sml,i,s)
#endif

#ifdef _DEBUG
#define sml_assert_str_in(sml,i,search,fnc) \
	if (!strstr(search, sml->stack[sml->top - 1 - (sml->tokp->n_args - i)]->obj.s)) { \
		printf("ASSERT ERROR : Invalid parameter value for parameter #%d, at line <%d> for function <%s>", i, sml->tokp->sourceLine,fnc); \
		longjmp(sml->env_buffer, 1); \
	}
#else
#define sml_assert_str_in(sml,i,f,s)
#endif

#ifdef _DEBUG
#define sml_assert_str(sml,i,fnc) \
	if (!strlen(sml->stack[sml->top - 1 - (sml->tokp->n_args - i)]->obj.s)) { \
		printf("ASSERT ERROR : Invalid parameter value (empty) for parameter #%d, at line <%d> for function <%s>", i, sml->tokp->sourceLine,fnc); \
		longjmp(sml->env_buffer, 1); \
	}
#else
#define sml_assert_str(sml,i,fnc)
#endif

#ifdef _DEBUG
#define sml_assert_size(sml,size,i,fnc) \
	if (size <= 0) { \
		printf("ASSERT ERROR : Invalid parameter value (<=0) for parameter #%d, at line <%d> for function <%s>", i, sml->tokp->sourceLine,fnc); \
		longjmp(sml->env_buffer, 1); \
	}
#else
#define sml_assert_size(sml,size,i,fnc)
#endif

#ifdef _DEBUG
#define sml_assert_gz(sml,size,fnc) \
	if (size < 0) { \
		printf("ASSERT ERROR : Invalid parameters (size validation < 0) at line <%d> for function <%s>", sml->tokp->sourceLine,fnc); \
		longjmp(sml->env_buffer, 1); \
	}
#else
#define sml_assert_gz(sml,size,fnc)
#endif

#ifdef _DEBUG
#define sml_assert_ptr(sml,p,i,fnc) \
	if (p == NULL) { \
		printf("ASSERT ERROR : Invalid parameter value (==NULL) for parameter #%d, at line <%d> for function <%s>", i, sml->tokp->sourceLine,fnc); \
		longjmp(sml->env_buffer, 1); \
	}
#else
#define sml_assert_ptr(sml,p,i,fnc)
#endif

#ifdef _DEBUG
#define sml_assert_range(sml,i,v,from,to,fnc) \
	if (v < from || v > to) { \
		printf("ASSERT ERROR : Invalid parameter value <%d> expected (%d - %d) for parameter #%d, at line <%d> for function <%s>", v, from, to, i, sml->tokp->sourceLine,fnc); \
		longjmp(sml->env_buffer, 1); \
	}
#else
#define sml_assert_range(sml,i,v,from,to,fnc)
#endif

#define sml_fatal_error(sml,c,fnc) \
		printf("ASSERT ERROR : Fatal error <%s> at line <%d> for function <%s>", c, sml->tokp->sourceLine , fnc); \
		longjmp(sml->env_buffer, 1);

max_stars_repo_name: vinej/sml

max_issues_repo_name: vinej/sml

max_forks_repo_name: vinej/sml


text:
/* fft/test.c
 *
 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Brian Gough
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include <config.h>
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <float.h>

#include <gsl/gsl_complex.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_dft_complex.h>
#include <gsl/gsl_fft_complex.h>
#include <gsl/gsl_fft_complex_float.h>
#include <gsl/gsl_fft_real.h>
#include <gsl/gsl_fft_real_float.h>
#include <gsl/gsl_fft_halfcomplex.h>
#include <gsl/gsl_fft_halfcomplex_float.h>
#include <gsl/gsl_ieee_utils.h>
#include <gsl/gsl_test.h>

void my_error_handler (const char *reason, const char *file,
                       int line, int err);

#include "complex_internal.h"

/* Usage: test [n]
   Exercise the fft routines for length n. By default n runs from 1 to 100.
   The exit status indicates success or failure. */

#define BASE_DOUBLE
#include "templates_on.h"
#include "compare_source.c"
#include "bitreverse.c"
#include "test_complex_source.c"
#include "test_real_source.c"
#include "test_trap_source.c"
#include "templates_off.h"
#undef  BASE_DOUBLE

#define BASE_FLOAT
#include "templates_on.h"
#include "compare_source.c"
#include "bitreverse.c"
#include "test_complex_source.c"
#include "test_real_source.c"
#include "test_trap_source.c"
#include "templates_off.h"
#undef  BASE_FLOAT

int
main (int argc, char *argv[])
{
  size_t i;
  size_t start = 1, end = 99;
  size_t stride ;
  size_t n = 0;

  gsl_ieee_env_setup ();

  if (argc == 2)
    n = strtol (argv[1], NULL, 0);

  if (n)
    {
      start = n ;
      end = n ;
    }

  for (i = 1 ; i <= end ; i *= 2)
    {
      if (i >= start)
        {
          for (stride = 1 ; stride < 4 ; stride++)
            {
              test_complex_bitreverse_order (stride, i) ;
              test_complex_radix2 (stride, i) ;
              test_real_bitreverse_order (stride, i) ;
              test_real_radix2 (stride, i) ;
            }
        }
    }

  for (i = start ; i <= end ; i++)
    {
      for (stride = 1 ; stride < 4 ; stride++)
        {
          test_complex_func (stride, i) ;
          test_complex_float_func (stride, i) ;
          test_real_func (stride, i) ;
          test_real_float_func (stride, i) ;
        }
    }

  gsl_set_error_handler (&my_error_handler);
  test_trap () ;
  test_float_trap () ;

  exit (gsl_test_summary ());
}

void
my_error_handler (const char *reason, const char *file, int line, int err)
{
  if (0) printf ("(caught [%s:%d: %s (%d)])\n", file, line, reason, err) ;
}

ext: c

max_stars_repo_name: manggoguy/parsec-modified

max_issues_repo_name: manggoguy/parsec-modified

max_forks_repo_name: manggoguy/parsec-modified


text:
/**
 *
 * @file core_zpltmg_circul.c
 *
 *  PLASMA core_blas kernel
 *  PLASMA is a software package provided by Univ. of Tennessee,
 *  Univ. of California Berkeley and Univ. of Colorado Denver
 *
 * @version 2.8.0
 * @author Mathieu Faverge
 * @date 2010-11-15
 * @precisions normal z -> c d s
 *
 **/
#include <lapacke.h>
#include <math.h>
#include "common.h"

/***************************************************************************//**
 *
 * @ingroup dplasma_cores_complex64
 *
 *  CORE_zpltmg_circul is a kernel used in circulant matrix generation
 *
 *  See http://www.mathworks.fr/fr/help/matlab/ref/gallery.html#f84-999880
 *
 *  Circulant matrix
 *
 *  A circulant matrix has the property that each row is obtained from the
 *  previous one by cyclically permuting the entries one step forward. It is a
 *  special Toeplitz matrix in which the diagonals "wrap around."
 *
 *  The eigensystem of C (n-by-n) is known explicitly: If t is an nth root of
 *  unity, then the inner product of v and w = [1 t t2 ... t(n – 1)] is an
 *  eigenvalue of C and w(n:-1:1) is an eigenvector, where v is the first column of
 *  C.
 *
 *
 *******************************************************************************
 *
 * @param[in] M
 *         The number of rows of the tile A to initialize. M >= 2.
 *
 * @param[in] N
 *         The number of columns of the tile A to initialize. N >= 0.
 *
 * @param[out] A
 *         On entry, the M-by-N tile to be initialized.
 *
 * @param[in] LDA
 *         The leading dimension of the tile A. LDA >= max(1,M).
 *
 * @param[in] gM
 *         The global number of rows of the full matrix, A is belonging to. gM >= (m0+gM).
 *
 * @param[in] m0
 *         The index of the first row of tile A in the full matrix. m0 >= 0.
 *
 * @param[in] n0
 *         The index of the first column of tile A in the full matrix. n0 >= 0.
 *
 * @param[in] V
 *          Workspace of size gM, that contains the first clumn of the full matrix
 *
 *******************************************************************************
 *
 * @return
 *         \retval PLASMA_SUCCESS successful exit
 *         \retval <0 if INFO = -k, the k-th argument had an illegal value
 *
 ******************************************************************************/
#if defined(PLASMA_HAVE_WEAK)
#pragma weak CORE_zpltmg_circul = PCORE_zpltmg_circul
#define CORE_zpltmg_circul PCORE_zpltmg_circul
#endif
int CORE_zpltmg_circul( int M, int N, PLASMA_Complex64_t *A, int LDA,
                        int gM, int m0, int n0,
                        const PLASMA_Complex64_t *V )
{
    int i, j, ii, jj;

    /* Check input arguments */
    if (M < 0) {
        coreblas_error(1, "Illegal value of M");
        return -1;
    }
    if (N < 0) {
        coreblas_error(2, "Illegal value of N");
        return -2;
    }
    if ((LDA < max(1,M)) && (M > 0)) {
        coreblas_error(4, "Illegal value of LDA");
        return -4;
    }
    if (m0 < 0) {
        coreblas_error(6, "Illegal value of m0");
        return -6;
    }
    if (n0 < 0) {
        coreblas_error(7, "Illegal value of n0");
        return -7;
    }
    if (gM < m0+M) {
        coreblas_error(5, "Illegal value of gM");
        return -5;
    }

    for (j=0, jj=n0; j<N; j++, jj++) {
        for (i=0, ii=m0; i<M; i++, ii++) {
            A[LDA*j + i] = V[ (jj-ii+gM)%gM ];
        }
    }

    return PLASMA_SUCCESS;
}

max_stars_repo_name: therault/dplasma

max_issues_repo_name: therault/dplasma

max_forks_repo_name: therault/dplasma