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

Function randomTrsvMatrices

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

Source from the content-addressed store, hash-verified

343
344template <typename T>
345static void
346randomTrsvMatrices(
347 clblasOrder order,
348 clblasUplo uplo,
349 clblasDiag diag,
350 size_t N,
351 T *A,
352 size_t lda,
353 T *X,
354 int incx)
355{
356 size_t i, j;
357 T min, max, x, y;
358 cl_double modMin, modMax, sum, maxDiag;
359
360 min = ZERO<T>();
361 max = ZERO<T>();
362 incx = abs(incx);
363 maxDiag = 1.0;
364
365 cl_double bound;
366 bound = (UPPER_BOUND<T>()/(N));
367
368 switch (diag) {
369 case clblasUnit:
370 for (i = 0; i < N; i++) {
371 // must not be accessed
372 if(lda > 0)
373 {
374 setElement<T>(order, clblasNoTrans, i, i, A, lda, ONE/*FNAN*/<T>());
375 }
376 else //Packed case
377 {
378 setElementPacked<T>(order, clblasNoTrans, uplo, i, i, A, N, ONE/*FNAN*/<T>());
379 }
380 }
381 break;
382 case clblasNonUnit:
383 /* Do not allow zeros on A's main diagonal and get a big number which is atleast greater than N/4*/
384 maxDiag = ((N/4) > bound) ? (bound/4) : (N/4);
385 maxDiag = (1 > (maxDiag)) ? 1 : maxDiag;
386 do {
387 max = randomTrsv<T>(bound);
388 } while ((module(max) < (maxDiag)));
389 modMax = module(max);
390 min = max / 100;
391 modMin = module(min);
392 if(lda > 0)
393 {
394 setElement<T>(order, clblasNoTrans, 0, 0, A, lda, max);
395 }
396 else //Packed Case
397 {
398 setElementPacked<T>(order, clblasNoTrans, uplo, 0, 0, A, N, max);
399 }
400 //printf("Diagonals %d ", max);
401 for (i = 1; i < N; i++) {
402 x = randomTrsv<T>(modMin, modMax);

Callers 3

prepareMethod · 0.85
prepareMethod · 0.85
generateDataMethod · 0.85

Calls 1

moduleFunction · 0.70

Tested by

no test coverage detected