| 80 | } |
| 81 | |
| 82 | std::string |
| 83 | KTest::generate(bool withAccuracy) |
| 84 | { |
| 85 | std::stringstream ss; |
| 86 | int level; |
| 87 | |
| 88 | ss << indent() << "#define _CRT_SECURE_NO_WARNINGS" << std::endl; |
| 89 | |
| 90 | ss << std::endl |
| 91 | << indent() << "#include <assert.h>" << std::endl |
| 92 | << indent() << "#include <math.h>" << std::endl |
| 93 | << indent() << "#include <stdio.h>" << std::endl |
| 94 | << indent() << "#include <stdlib.h>" << std::endl |
| 95 | << indent() << "#include <string.h>" << std::endl |
| 96 | << indent() << "#include <time.h>" << std::endl |
| 97 | << indent() << "#include <string>" << std::endl; |
| 98 | if (masterStep_->blasFunctionID() == CLBLAS_TRSM) { |
| 99 | ss << indent() << "#include <math.h>" << std::endl |
| 100 | << indent() << "#define NANF NAN" << std::endl; |
| 101 | } |
| 102 | |
| 103 | includes(ss); |
| 104 | ss << std::endl |
| 105 | << indent() << "#include \"naive_blas.cpp\"" << std::endl |
| 106 | << std::endl |
| 107 | << indent() << "using namespace NaiveBlas;" << std::endl; |
| 108 | |
| 109 | if (masterStep_->blasFunctionID() == CLBLAS_TRSM) { |
| 110 | setUpTRSMDiagonal(ss); |
| 111 | } |
| 112 | |
| 113 | level = funcBlasLevel(masterStep_->blasFunctionID()); |
| 114 | |
| 115 | switch (matrixGen_) { |
| 116 | case RANDOM_MATRIX: |
| 117 | if (level == 2) { |
| 118 | randomVector(ss); |
| 119 | } |
| 120 | randomMatrix(ss); |
| 121 | break; |
| 122 | case UNIT_MATRIX: |
| 123 | if (level == 2) { |
| 124 | unitVector(ss); |
| 125 | } |
| 126 | unitMatrix(ss); |
| 127 | break; |
| 128 | case SAWTOOTH_MATRIX: |
| 129 | if (level == 2) { |
| 130 | sawtoothVector(ss); |
| 131 | } |
| 132 | sawtoothMatrix(ss); |
| 133 | break; |
| 134 | default: |
| 135 | break; |
| 136 | } |
| 137 | |
| 138 | if (withAccuracy) { |
| 139 | if (level == 2) { |
nothing calls this directly
no test coverage detected