MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / doTriangleOperation

Function doTriangleOperation

src/tests/include/blas-random.h:946–1008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

944
945template <typename T>
946static void
947doTriangleOperation(TRIANGLE_OPERATIONS op, T* data, size_t rows, size_t cols, size_t lda, int vectorLength, int creationFlags )
948{
949 size_t firstdimension, seconddimension;
950 T *p1, *p2;
951 size_t start, end;
952
953 if (creationFlags & ROW_MAJOR_ORDER)
954 {
955 firstdimension = rows;
956 seconddimension = cols;
957 } else {
958 firstdimension = cols;
959 seconddimension = rows;
960 }
961
962 for(size_t i=0; i<firstdimension; i++)
963 {
964 //
965 // Get the correct Lower Triangle offsets for ROW
966 // and COL major matrices
967 //
968 if (creationFlags & ROW_MAJOR_ORDER)
969 {
970 start =0; end = i;
971 } else {
972 start =i+1; end = seconddimension;
973 }
974
975 for(size_t j=start; j<end; j++)
976 {
977 p1 = (T *)data + i*lda*vectorLength + j*vectorLength; // LT Address
978 p2 = (T *)data + j*lda*vectorLength + i*vectorLength; // UT Address
979 switch(op)
980 {
981 case LTOU:
982 for(int k=0; k<vectorLength; k++)
983 {
984 p2[k] = p1[k];
985 }
986 break;
987 case UTOL:
988 for(int k=0; k<vectorLength; k++)
989 {
990 p1[k] = p2[k];
991 }
992 break;
993 case SWAP:
994 for(int k=0; k<vectorLength; k++)
995 {
996 T temp;
997
998 temp = p2[k];
999 p1[k] = p2[k];
1000 p2[k] = temp;
1001 }
1002 break;
1003 default:

Callers 1

doPopulateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected