| 861 | |
| 862 | template <typename T> |
| 863 | static void |
| 864 | setTriangularMatrixWithRandomData(char uplo, T* data, size_t rows, size_t cols, size_t lda, int vectorLength, int creationFlags, cl_double bound) |
| 865 | { |
| 866 | |
| 867 | // Packed Matrix |
| 868 | if (creationFlags & PACKED_MATRIX) |
| 869 | { |
| 870 | if (uplo == 'L') |
| 871 | { |
| 872 | for( size_t i=0; i < rows; i++) |
| 873 | { |
| 874 | for( size_t j=0; j < i; j++) // Don't touch diagonals |
| 875 | { |
| 876 | //setRandom( (flags & ROW_MAJOR) ? RMLPacked(i,j) : CMLPacked(i,j)); |
| 877 | setElementWithRandomData( (creationFlags & ROW_MAJOR_ORDER) ? RMLPacked(i,j) : RMUPacked(j,i), vectorLength, bound); |
| 878 | } |
| 879 | } |
| 880 | } |
| 881 | else |
| 882 | { |
| 883 | for( size_t i=0; i < rows; i++) |
| 884 | { |
| 885 | for( size_t j=(i+1); j < cols; j++) // Don't touch diagonals |
| 886 | { |
| 887 | //printf("(i,j) -- (%d,%d) : Index : %d\n", i, j, ((i*((2*rows) + 1 - i))/2 + (j -i))); |
| 888 | setElementWithRandomData( (creationFlags & ROW_MAJOR_ORDER) ? RMUPacked(i,j) : RMLPacked(j,i), vectorLength, bound); |
| 889 | } |
| 890 | } |
| 891 | } |
| 892 | } |
| 893 | else |
| 894 | { |
| 895 | // Row Major - rows x lda |
| 896 | // Col major - lda x cols |
| 897 | size_t firstdimension, seconddimension; |
| 898 | T *p; |
| 899 | |
| 900 | if ((uplo != 'U') && (uplo != 'L')) |
| 901 | { |
| 902 | throw -1; |
| 903 | } |
| 904 | |
| 905 | if (creationFlags & ROW_MAJOR_ORDER) |
| 906 | { |
| 907 | firstdimension = rows; |
| 908 | seconddimension = cols; |
| 909 | } else { |
| 910 | firstdimension = cols; |
| 911 | seconddimension = rows; |
| 912 | if (uplo == 'U') |
| 913 | { |
| 914 | uplo = 'L'; |
| 915 | } else { |
| 916 | uplo = 'U'; |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | for(size_t i=0; i<firstdimension; i++) |
no test coverage detected