⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_spmv.c

📁 开放gsl矩阵运算
💻 C
字号:
#include <gsl/gsl_test.h>#include <gsl/gsl_ieee_utils.h>#include <gsl/gsl_math.h>#include "gsl_cblas.h"#include "tests.h"voidtest_spmv (void) {const double flteps = 1e-4, dbleps = 1e-6;  {   int order = 101;   int uplo = 121;   float alpha = 0.1f;   float beta = -0.3f;   int N = 2;   float A[] = { -0.174f, 0.878f, 0.478f };   float X[] = { 0.503f, 0.313f };   int incX = -1;   float Y[] = { -0.565f, -0.109f };   int incY = -1;   float y_expected[] = { 0.221025f, 0.0714172f };   cblas_sspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], flteps, "sspmv(case 1134)");     }   };  };  {   int order = 101;   int uplo = 121;   float alpha = 0.1f;   float beta = -0.3f;   int N = 2;   float A[] = { -0.174f, 0.878f, 0.478f };   float X[] = { 0.503f, 0.313f };   int incX = -1;   float Y[] = { -0.565f, -0.109f };   int incY = -1;   float y_expected[] = { 0.221025f, 0.0714172f };   cblas_sspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], flteps, "sspmv(case 1135)");     }   };  };  {   int order = 101;   int uplo = 122;   float alpha = 0.1f;   float beta = -0.3f;   int N = 2;   float A[] = { -0.174f, 0.878f, 0.478f };   float X[] = { 0.503f, 0.313f };   int incX = -1;   float Y[] = { -0.565f, -0.109f };   int incY = -1;   float y_expected[] = { 0.221025f, 0.0714172f };   cblas_sspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], flteps, "sspmv(case 1136)");     }   };  };  {   int order = 101;   int uplo = 122;   float alpha = 0.1f;   float beta = -0.3f;   int N = 2;   float A[] = { -0.174f, 0.878f, 0.478f };   float X[] = { 0.503f, 0.313f };   int incX = -1;   float Y[] = { -0.565f, -0.109f };   int incY = -1;   float y_expected[] = { 0.221025f, 0.0714172f };   cblas_sspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], flteps, "sspmv(case 1137)");     }   };  };  {   int order = 102;   int uplo = 121;   float alpha = 0.1f;   float beta = -0.3f;   int N = 2;   float A[] = { -0.174f, 0.878f, 0.478f };   float X[] = { 0.503f, 0.313f };   int incX = -1;   float Y[] = { -0.565f, -0.109f };   int incY = -1;   float y_expected[] = { 0.221025f, 0.0714172f };   cblas_sspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], flteps, "sspmv(case 1138)");     }   };  };  {   int order = 102;   int uplo = 121;   float alpha = 0.1f;   float beta = -0.3f;   int N = 2;   float A[] = { -0.174f, 0.878f, 0.478f };   float X[] = { 0.503f, 0.313f };   int incX = -1;   float Y[] = { -0.565f, -0.109f };   int incY = -1;   float y_expected[] = { 0.221025f, 0.0714172f };   cblas_sspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], flteps, "sspmv(case 1139)");     }   };  };  {   int order = 102;   int uplo = 122;   float alpha = 0.1f;   float beta = -0.3f;   int N = 2;   float A[] = { -0.174f, 0.878f, 0.478f };   float X[] = { 0.503f, 0.313f };   int incX = -1;   float Y[] = { -0.565f, -0.109f };   int incY = -1;   float y_expected[] = { 0.221025f, 0.0714172f };   cblas_sspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], flteps, "sspmv(case 1140)");     }   };  };  {   int order = 102;   int uplo = 122;   float alpha = 0.1f;   float beta = -0.3f;   int N = 2;   float A[] = { -0.174f, 0.878f, 0.478f };   float X[] = { 0.503f, 0.313f };   int incX = -1;   float Y[] = { -0.565f, -0.109f };   int incY = -1;   float y_expected[] = { 0.221025f, 0.0714172f };   cblas_sspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], flteps, "sspmv(case 1141)");     }   };  };  {   int order = 101;   int uplo = 121;   double alpha = -1;   double beta = 0.1;   int N = 2;   double A[] = { -0.181, -0.071, -0.038 };   double X[] = { -0.015, 0.132 };   int incX = -1;   double Y[] = { -0.449, -0.219 };   int incY = -1;   double y_expected[] = { -0.036098, 9.27e-04 };   cblas_dspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], dbleps, "dspmv(case 1142)");     }   };  };  {   int order = 101;   int uplo = 121;   double alpha = -1;   double beta = 0.1;   int N = 2;   double A[] = { -0.181, -0.071, -0.038 };   double X[] = { -0.015, 0.132 };   int incX = -1;   double Y[] = { -0.449, -0.219 };   int incY = -1;   double y_expected[] = { -0.036098, 9.27e-04 };   cblas_dspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], dbleps, "dspmv(case 1143)");     }   };  };  {   int order = 101;   int uplo = 122;   double alpha = -1;   double beta = 0.1;   int N = 2;   double A[] = { -0.181, -0.071, -0.038 };   double X[] = { -0.015, 0.132 };   int incX = -1;   double Y[] = { -0.449, -0.219 };   int incY = -1;   double y_expected[] = { -0.036098, 9.27e-04 };   cblas_dspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], dbleps, "dspmv(case 1144)");     }   };  };  {   int order = 101;   int uplo = 122;   double alpha = -1;   double beta = 0.1;   int N = 2;   double A[] = { -0.181, -0.071, -0.038 };   double X[] = { -0.015, 0.132 };   int incX = -1;   double Y[] = { -0.449, -0.219 };   int incY = -1;   double y_expected[] = { -0.036098, 9.27e-04 };   cblas_dspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], dbleps, "dspmv(case 1145)");     }   };  };  {   int order = 102;   int uplo = 121;   double alpha = -1;   double beta = 0.1;   int N = 2;   double A[] = { -0.181, -0.071, -0.038 };   double X[] = { -0.015, 0.132 };   int incX = -1;   double Y[] = { -0.449, -0.219 };   int incY = -1;   double y_expected[] = { -0.036098, 9.27e-04 };   cblas_dspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], dbleps, "dspmv(case 1146)");     }   };  };  {   int order = 102;   int uplo = 121;   double alpha = -1;   double beta = 0.1;   int N = 2;   double A[] = { -0.181, -0.071, -0.038 };   double X[] = { -0.015, 0.132 };   int incX = -1;   double Y[] = { -0.449, -0.219 };   int incY = -1;   double y_expected[] = { -0.036098, 9.27e-04 };   cblas_dspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], dbleps, "dspmv(case 1147)");     }   };  };  {   int order = 102;   int uplo = 122;   double alpha = -1;   double beta = 0.1;   int N = 2;   double A[] = { -0.181, -0.071, -0.038 };   double X[] = { -0.015, 0.132 };   int incX = -1;   double Y[] = { -0.449, -0.219 };   int incY = -1;   double y_expected[] = { -0.036098, 9.27e-04 };   cblas_dspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], dbleps, "dspmv(case 1148)");     }   };  };  {   int order = 102;   int uplo = 122;   double alpha = -1;   double beta = 0.1;   int N = 2;   double A[] = { -0.181, -0.071, -0.038 };   double X[] = { -0.015, 0.132 };   int incX = -1;   double Y[] = { -0.449, -0.219 };   int incY = -1;   double y_expected[] = { -0.036098, 9.27e-04 };   cblas_dspmv(order, uplo, N, alpha, A, X, incX, beta, Y, incY);   {     int i;     for (i = 0; i < 2; i++) {       gsl_test_rel(Y[i], y_expected[i], dbleps, "dspmv(case 1149)");     }   };  };}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -