1 #include "UnaryTestsF64.h"
2 #include "Error.h"
3
4 #define SNR_THRESHOLD 250
5
6 /*
7
8 Reference patterns are generated with
9 a double precision computation.
10
11 */
12 #define REL_ERROR (1.0e-12)
13 #define ABS_ERROR (1.0e-12)
14
15 /*
16
17 Comparisons for householder
18
19 */
20 #define SNR_HOUSEHOLDER_THRESHOLD 270
21 #define REL_HOUSEHOLDER_ERROR (1.0e-13)
22 #define ABS_HOUSEHOLDER_ERROR (1.0e-13)
23
24 /*
25
26 Comparison for QR decomposition
27
28 */
29 #define SNR_QR_THRESHOLD 270
30 #define REL_QR_ERROR (1.0e-13)
31 #define ABS_QR_ERROR (1.0e-13)
32
33 /*
34
35 Comparison for Cholesky
36
37 */
38 #define SNR_THRESHOLD_CHOL 269
39 #define REL_ERROR_CHOL (1.0e-9)
40 #define ABS_ERROR_CHOL (1.0e-9)
41
42 /* LDLT comparison */
43
44 #define REL_ERROR_LDLT (1e-5)
45 #define ABS_ERROR_LDLT (1e-5)
46
47 /* Upper bound of maximum matrix dimension used by Python */
48 #define MAXMATRIXDIM 40
49
50 #define LOADDATA2() \
51 const float64_t *inp1=input1.ptr(); \
52 const float64_t *inp2=input2.ptr(); \
53 \
54 float64_t *ap=a.ptr(); \
55 float64_t *bp=b.ptr(); \
56 \
57 float64_t *outp=output.ptr(); \
58 int16_t *dimsp = dims.ptr(); \
59 int nbMatrixes = dims.nbSamples() >> 1;\
60 int rows,columns; \
61 int i;
62
63 #define LOADDATA1() \
64 const float64_t *inp1=input1.ptr(); \
65 \
66 float64_t *ap=a.ptr(); \
67 \
68 float64_t *outp=output.ptr(); \
69 int16_t *dimsp = dims.ptr(); \
70 int nbMatrixes = dims.nbSamples() >> 1;\
71 int rows,columns; \
72 int i;
73
74 #define PREPAREDATA2() \
75 in1.numRows=rows; \
76 in1.numCols=columns; \
77 memcpy((void*)ap,(const void*)inp1,sizeof(float64_t)*rows*columns);\
78 in1.pData = ap; \
79 \
80 in2.numRows=rows; \
81 in2.numCols=columns; \
82 memcpy((void*)bp,(const void*)inp2,sizeof(float64_t)*rows*columns);\
83 in2.pData = bp; \
84 \
85 out.numRows=rows; \
86 out.numCols=columns; \
87 out.pData = outp;
88
89 #define PREPAREDATALT() \
90 in1.numRows=rows; \
91 in1.numCols=rows; \
92 memcpy((void*)ap,(const void*)inp1,sizeof(float64_t)*rows*rows); \
93 in1.pData = ap; \
94 \
95 in2.numRows=rows; \
96 in2.numCols=columns; \
97 memcpy((void*)bp,(const void*)inp2,sizeof(float64_t)*rows*columns);\
98 in2.pData = bp; \
99 \
100 out.numRows=rows; \
101 out.numCols=columns; \
102 out.pData = outp;
103
104 #define PREPAREDATA1(TRANSPOSED) \
105 in1.numRows=rows; \
106 in1.numCols=columns; \
107 memcpy((void*)ap,(const void*)inp1,sizeof(float64_t)*rows*columns);\
108 in1.pData = ap; \
109 \
110 if (TRANSPOSED) \
111 { \
112 out.numRows=columns; \
113 out.numCols=rows; \
114 } \
115 else \
116 { \
117 out.numRows=rows; \
118 out.numCols=columns; \
119 } \
120 out.pData = outp;
121
122 #define PREPAREDATALL1() \
123 in1.numRows=rows; \
124 in1.numCols=columns; \
125 memcpy((void*)ap,(const void*)inp1,sizeof(float64_t)*rows*columns);\
126 in1.pData = ap; \
127 \
128 outll.numRows=rows; \
129 outll.numCols=columns; \
130 \
131 outll.pData = outllp;
132
133 #define SWAP_ROWS(A,i,j) \
134 for(int w=0;w < n; w++) \
135 { \
136 float64_t tmp; \
137 tmp = A[i*n + w]; \
138 A[i*n + w] = A[j*n + w];\
139 A[j*n + w] = tmp; \
140 }
141
checkInnerTailOverflow(float64_t * b)142 static void checkInnerTailOverflow(float64_t *b)
143 {
144 ASSERT_TRUE(b[0] == 0);
145 ASSERT_TRUE(b[1] == 0);
146 }
147
148
test_mat_add_f64()149 void UnaryTestsF64::test_mat_add_f64()
150 {
151
152 }
153
test_householder_f64()154 void UnaryTestsF64::test_householder_f64()
155 {
156 int64_t vecDim;
157 const int16_t *dimsp = dims.ptr();
158 const int nbVectors = dims.nbSamples();
159 const float64_t *inp1=input1.ptr();
160
161 float64_t *outp=output.ptr();
162 float64_t *outBetap=outputBeta.ptr();
163
164
165 for(int i=0; i < nbVectors ; i++)
166 {
167 vecDim = *dimsp++;
168
169 float64_t beta = arm_householder_f64(inp1,DEFAULT_HOUSEHOLDER_THRESHOLD_F64,vecDim,outp);
170 *outBetap = beta;
171
172 outp += vecDim;
173 inp1 += vecDim;
174 outBetap++;
175 checkInnerTailOverflow(outp);
176 checkInnerTailOverflow(outBetap);
177
178 }
179
180 ASSERT_EMPTY_TAIL(output);
181 ASSERT_EMPTY_TAIL(outputBeta);
182
183 ASSERT_SNR(output,ref,(float64_t)SNR_HOUSEHOLDER_THRESHOLD);
184 ASSERT_SNR(outputBeta,refBeta,(float64_t)SNR_HOUSEHOLDER_THRESHOLD);
185
186 ASSERT_CLOSE_ERROR(output,ref,ABS_HOUSEHOLDER_ERROR,REL_HOUSEHOLDER_ERROR);
187 ASSERT_CLOSE_ERROR(outputBeta,refBeta,ABS_HOUSEHOLDER_ERROR,REL_HOUSEHOLDER_ERROR);
188
189
190 }
191
192 #include "dsp/debug.h"
193
test_mat_qr_f64()194 void UnaryTestsF64::test_mat_qr_f64()
195 {
196 int64_t rows, columns, rank;
197 int nb;
198 const int16_t *dimsp = dims.ptr();
199 const int nbMatrixes = dims.nbSamples() / 3;
200 const float64_t *inp1=input1.ptr();
201
202 float64_t *outTaup=outputTau.ptr();
203 float64_t *outRp=outputR.ptr();
204 float64_t *outQp=outputQ.ptr();
205
206 float64_t *pTmpA=a.ptr();
207 float64_t *pTmpB=b.ptr();
208
209 (void) outTaup;
210 (void) outRp;
211 (void) outQp;
212 (void)nbMatrixes;
213 (void)nb;
214 (void)dimsp;
215 (void)inp1;
216
217 nb=0;
218 for(int i=0; i < nbMatrixes ; i++)
219 //for(int i=0; i < 1 ; i++)
220 {
221 rows = *dimsp++;
222 columns = *dimsp++;
223 rank = *dimsp++;
224 (void)rank;
225
226 //printf("--> %d %d : %lld %lld\n",nb,i,rows,columns);
227 nb += rows * columns;
228
229 in1.numRows=rows;
230 in1.numCols=columns;
231 in1.pData = (float64_t*)inp1;
232
233 outR.numRows = rows;
234 outR.numCols = columns;
235 outR.pData = (float64_t*)outRp;
236
237 outQ.numRows = rows;
238 outQ.numCols = rows;
239 outQ.pData = (float64_t*)outQp;
240
241
242 arm_status status=arm_mat_qr_f64(&in1,DEFAULT_HOUSEHOLDER_THRESHOLD_F64,&outR,&outQ,outTaup,pTmpA,pTmpB);
243 ASSERT_TRUE(status==ARM_MATH_SUCCESS);
244
245 // Set Householder reflectors into R matrix to 0
246 //float64_t *p = outRp ;
247 //printf("%d %d %d\n",in1.numCols, outR.numRows,outR.numCols);
248 #if 0
249 for(int col=0 ; col < in1.numCols; col++)
250 {
251 float64_t *pa = p + outR.numCols;
252 for(int k=0;k<outR.numRows-col-1; k++)
253 {
254 *pa = 0;
255 pa += outR.numCols;
256 }
257 p += 1 + outR.numCols;
258 }
259 #endif
260 //PM_f64("Corrected R",&outR);
261
262 inp1 += rows * columns;
263 outRp += rows * columns;
264 outQp += rows * rows;
265 outTaup += columns;
266
267 checkInnerTailOverflow(outRp);
268 checkInnerTailOverflow(outQp);
269 checkInnerTailOverflow(outTaup);
270
271
272 }
273
274
275 ASSERT_EMPTY_TAIL(outputR);
276 ASSERT_EMPTY_TAIL(outputQ);
277 ASSERT_EMPTY_TAIL(outputTau);
278
279 ASSERT_SNR(refQ,outputQ,(float64_t)SNR_QR_THRESHOLD);
280 ASSERT_SNR(refR,outputR,(float64_t)SNR_QR_THRESHOLD);
281 ASSERT_SNR(refTau,outputTau,(float64_t)SNR_QR_THRESHOLD);
282
283 ASSERT_CLOSE_ERROR(refQ,outputQ,ABS_QR_ERROR,REL_QR_ERROR);
284 ASSERT_CLOSE_ERROR(refR,outputR,ABS_QR_ERROR,REL_QR_ERROR);
285 ASSERT_CLOSE_ERROR(refTau,outputTau,ABS_QR_ERROR,REL_QR_ERROR);
286 }
287
test_mat_sub_f64()288 void UnaryTestsF64::test_mat_sub_f64()
289 {
290 LOADDATA2();
291 arm_status status;
292
293 for(i=0;i < nbMatrixes ; i ++)
294 {
295 rows = *dimsp++;
296 columns = *dimsp++;
297
298 PREPAREDATA2();
299
300 status=arm_mat_sub_f64(&this->in1,&this->in2,&this->out);
301 ASSERT_TRUE(status==ARM_MATH_SUCCESS);
302
303 outp += (rows * columns);
304
305 }
306
307 ASSERT_EMPTY_TAIL(output);
308
309 ASSERT_SNR(output,ref,(float64_t)SNR_THRESHOLD);
310
311 ASSERT_CLOSE_ERROR(output,ref,ABS_ERROR,REL_ERROR);
312 }
313
test_mat_scale_f64()314 void UnaryTestsF64::test_mat_scale_f64()
315 {
316
317 }
318
test_mat_trans_f64()319 void UnaryTestsF64::test_mat_trans_f64()
320 {
321 LOADDATA1();
322 arm_status status;
323
324 for(i=0;i < nbMatrixes ; i ++)
325 {
326 rows = *dimsp++;
327 columns = *dimsp++;
328
329 PREPAREDATA1(true);
330
331 status=arm_mat_trans_f64(&this->in1,&this->out);
332 ASSERT_TRUE(status==ARM_MATH_SUCCESS);
333
334 outp += (rows * columns);
335
336 }
337
338 ASSERT_EMPTY_TAIL(output);
339
340 ASSERT_SNR(output,ref,(float32_t)SNR_THRESHOLD);
341
342 ASSERT_CLOSE_ERROR(output,ref,ABS_ERROR,REL_ERROR);
343
344 }
345
346 /*
347
348 Test framework is only adding 16 bytes of free memory after the end of a buffer.
349 So, we limit to 2 float64 for checking out of buffer write.
350 */
refInnerTail(float64_t * b)351 static void refInnerTail(float64_t *b)
352 {
353 b[0] = 1.0;
354 b[1] = -2.0;
355 }
356
checkInnerTail(float64_t * b)357 static void checkInnerTail(float64_t *b)
358 {
359 ASSERT_TRUE(b[0] == 1.0);
360 ASSERT_TRUE(b[1] == -2.0);
361 }
362
363
test_mat_inverse_f64()364 void UnaryTestsF64::test_mat_inverse_f64()
365 {
366 const float64_t *inp1=input1.ptr();
367
368 float64_t *ap=a.ptr();
369
370 float64_t *outp=output.ptr();
371 int16_t *dimsp = dims.ptr();
372 int nbMatrixes = dims.nbSamples();
373 int rows,columns;
374 int i;
375 arm_status status;
376
377 // Non singular matrixes
378 // Last matrix is singular
379 for(i=0;i < nbMatrixes - 1 ; i ++)
380 {
381 rows = *dimsp++;
382 columns = rows;
383
384 PREPAREDATA1(false);
385
386 refInnerTail(outp+(rows * columns));
387
388 status=arm_mat_inverse_f64(&this->in1,&this->out);
389 ASSERT_TRUE(status==ARM_MATH_SUCCESS);
390
391 outp += (rows * columns);
392 inp1 += (rows * columns);
393
394 checkInnerTail(outp);
395
396 }
397 /*** Singular matrix **/
398 rows = *dimsp++;
399 columns = rows;
400
401 PREPAREDATA1(false);
402
403 refInnerTail(outp+(rows * columns));
404
405 status=arm_mat_inverse_f64(&this->in1,&this->out);
406 ASSERT_TRUE(status==ARM_MATH_SINGULAR);
407
408 outp += (rows * columns);
409 inp1 += (rows * columns);
410
411 checkInnerTail(outp);
412 /**********************/
413
414
415 ASSERT_SNR(output,ref,(float64_t)SNR_THRESHOLD);
416
417 ASSERT_CLOSE_ERROR(output,ref,ABS_ERROR,REL_ERROR);
418
419 }
420
test_mat_cholesky_dpo_f64()421 void UnaryTestsF64::test_mat_cholesky_dpo_f64()
422 {
423 float64_t *ap=a.ptr();
424 const float64_t *inp1=input1.ptr();
425
426
427 float64_t *outp=output.ptr();
428 int16_t *dimsp = dims.ptr();
429 int nbMatrixes = dims.nbSamples();
430
431 int rows,columns;
432 int i;
433 arm_status status;
434
435 for(i=0;i < nbMatrixes ; i ++)
436 {
437 rows = *dimsp++;
438 columns = rows;
439
440 PREPAREDATA1(false);
441
442 status=arm_mat_cholesky_f64(&this->in1,&this->out);
443 ASSERT_TRUE(status==ARM_MATH_SUCCESS);
444
445 outp += (rows * columns);
446 inp1 += (rows * columns);
447
448 }
449
450 ASSERT_EMPTY_TAIL(output);
451
452 ASSERT_SNR(output,ref,(float64_t)SNR_THRESHOLD_CHOL);
453
454 ASSERT_CLOSE_ERROR(ref,output,ABS_ERROR_CHOL,REL_ERROR_CHOL);
455 }
456
test_solve_upper_triangular_f64()457 void UnaryTestsF64::test_solve_upper_triangular_f64()
458 {
459 float64_t *ap=a.ptr();
460 const float64_t *inp1=input1.ptr();
461
462 float64_t *bp=b.ptr();
463 const float64_t *inp2=input2.ptr();
464
465
466 float64_t *outp=output.ptr();
467 int16_t *dimsp = dims.ptr();
468 int nbMatrixes = dims.nbSamples()>>1;
469
470 int rows,columns;
471 int i;
472 arm_status status;
473
474 for(i=0;i < nbMatrixes ; i ++)
475 {
476 rows = *dimsp++;
477 columns = *dimsp++;
478
479 PREPAREDATALT();
480
481 status=arm_mat_solve_upper_triangular_f64(&this->in1,&this->in2,&this->out);
482 ASSERT_TRUE(status==ARM_MATH_SUCCESS);
483
484 outp += (rows * columns);
485 inp1 += (rows * rows);
486 inp2 += (rows * columns);
487
488 }
489
490 ASSERT_EMPTY_TAIL(output);
491
492 ASSERT_SNR(output,ref,(float64_t)SNR_THRESHOLD);
493
494 ASSERT_CLOSE_ERROR(ref,output,ABS_ERROR,REL_ERROR);
495 }
496
test_solve_lower_triangular_f64()497 void UnaryTestsF64::test_solve_lower_triangular_f64()
498 {
499 float64_t *ap=a.ptr();
500 const float64_t *inp1=input1.ptr();
501
502 float64_t *bp=b.ptr();
503 const float64_t *inp2=input2.ptr();
504
505
506 float64_t *outp=output.ptr();
507 int16_t *dimsp = dims.ptr();
508 int nbMatrixes = dims.nbSamples()>>1;
509
510 int rows,columns;
511 int i;
512 arm_status status;
513
514 for(i=0;i < nbMatrixes ; i ++)
515 {
516 rows = *dimsp++;
517 columns = *dimsp++;
518
519 PREPAREDATALT();
520
521 status=arm_mat_solve_lower_triangular_f64(&this->in1,&this->in2,&this->out);
522 ASSERT_TRUE(status==ARM_MATH_SUCCESS);
523
524 outp += (rows * columns);
525 inp1 += (rows * rows);
526 inp2 += (rows * columns);
527
528 }
529
530 ASSERT_EMPTY_TAIL(output);
531
532 ASSERT_SNR(output,ref,(float64_t)SNR_THRESHOLD);
533
534 ASSERT_CLOSE_ERROR(ref,output,ABS_ERROR,REL_ERROR);
535 }
536
trans_f64(const float64_t * src,float64_t * dst,int n)537 static void trans_f64(const float64_t *src, float64_t *dst, int n)
538 {
539 for(int r=0; r<n ; r++)
540 {
541 for(int c=0; c<n ; c++)
542 {
543 dst[c*n+r] = src[r*n+c];
544 }
545 }
546 }
547
mult_f64_f64(const float64_t * srcA,const float64_t * srcB,float64_t * dst,int n)548 static void mult_f64_f64(const float64_t *srcA, const float64_t *srcB, float64_t *dst,int n)
549 {
550 for(int r=0; r<n ; r++)
551 {
552 for(int c=0; c<n ; c++)
553 {
554 float64_t sum=0.0;
555 for(int k=0; k < n ; k++)
556 {
557 sum += srcA[r*n+k] * srcB[k*n+c];
558 }
559 dst[r*n+c] = sum;
560 }
561 }
562 }
563
compute_ldlt_error(const int n,const int16_t * outpp)564 void UnaryTestsF64::compute_ldlt_error(const int n,const int16_t *outpp)
565 {
566 float64_t *tmpa = tmpapat.ptr() ;
567 float64_t *tmpb = tmpbpat.ptr() ;
568 float64_t *tmpc = tmpcpat.ptr() ;
569
570
571 /* Compute P A P^t */
572
573 // Create identiy matrix
574 for(int r=0; r < n; r++)
575 {
576 for(int c=0; c < n; c++)
577 {
578 if (r == c)
579 {
580 tmpa[r*n+c] = 1.0;
581 }
582 else
583 {
584 tmpa[r*n+c] = 0.0;
585 }
586 }
587 }
588
589 // Create permutation matrix
590
591 for(int r=0;r < n; r++)
592 {
593 SWAP_ROWS(tmpa,r,outpp[r]);
594 }
595
596
597
598 trans_f64((const float64_t*)tmpa,tmpb,n);
599 mult_f64_f64((const float64_t*)this->in1.pData,(const float64_t*)tmpb,tmpc,n);
600 mult_f64_f64((const float64_t*)tmpa,(const float64_t*)tmpc,outa,n);
601
602
603 /* Compute L D L^t */
604 trans_f64((const float64_t*)this->outll.pData,tmpc,n);
605 mult_f64_f64((const float64_t*)this->outd.pData,(const float64_t*)tmpc,tmpa,n);
606 mult_f64_f64((const float64_t*)this->outll.pData,(const float64_t*)tmpa,outb,n);
607
608
609 }
610
test_mat_ldl_f64()611 void UnaryTestsF64::test_mat_ldl_f64()
612 {
613 float64_t *ap=a.ptr();
614 const float64_t *inp1=input1.ptr();
615
616
617 float64_t *outllp=outputll.ptr();
618 float64_t *outdp=outputd.ptr();
619 int16_t *outpp=outputp.ptr();
620
621
622 outa=outputa.ptr();
623 outb=outputb.ptr();
624
625 int16_t *dimsp = dims.ptr();
626 int nbMatrixes = dims.nbSamples();
627
628 int rows,columns;
629 int i;
630 arm_status status;
631
632
633 for(i=0;i < nbMatrixes ; i ++)
634 {
635 rows = *dimsp++;
636 columns = rows;
637
638 PREPAREDATALL1();
639
640 outd.numRows=rows;
641 outd.numCols=columns;
642 outd.pData=outdp;
643
644
645
646
647 memset(outpp,0,rows*sizeof(uint16_t));
648 memset(outdp,0,columns*rows*sizeof(float64_t));
649
650 status=arm_mat_ldlt_f64(&this->in1,&this->outll,&this->outd,(uint16_t*)outpp);
651 ASSERT_TRUE(status==ARM_MATH_SUCCESS);
652
653 compute_ldlt_error(rows,outpp);
654
655 outllp += (rows * columns);
656 outdp += (rows * columns);
657 outpp += rows;
658
659 outa += (rows * columns);
660 outb +=(rows * columns);
661
662 inp1 += (rows * columns);
663
664 }
665
666 ASSERT_EMPTY_TAIL(outputll);
667 ASSERT_EMPTY_TAIL(outputd);
668 ASSERT_EMPTY_TAIL(outputp);
669 ASSERT_EMPTY_TAIL(outputa);
670 ASSERT_EMPTY_TAIL(outputb);
671
672
673 ASSERT_CLOSE_ERROR(outputa,outputb,ABS_ERROR_LDLT,REL_ERROR_LDLT);
674
675
676
677
678
679 }
680
681
setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)682 void UnaryTestsF64::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
683 {
684
685 (void)params;
686 switch(id)
687 {
688 case TEST_MAT_SUB_F64_2:
689 input1.reload(UnaryTestsF64::INPUTS1_F64_ID,mgr);
690 input2.reload(UnaryTestsF64::INPUTS2_F64_ID,mgr);
691 dims.reload(UnaryTestsF64::DIMSUNARY1_S16_ID,mgr);
692
693 ref.reload(UnaryTestsF64::REFSUB1_F64_ID,mgr);
694
695 output.create(ref.nbSamples(),UnaryTestsF64::OUT_F64_ID,mgr);
696 a.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPA_F64_ID,mgr);
697 b.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPB_F64_ID,mgr);
698 break;
699 case TEST_MAT_TRANS_F64_4:
700 input1.reload(UnaryTestsF64::INPUTS1_F64_ID,mgr);
701 dims.reload(UnaryTestsF64::DIMSUNARY1_S16_ID,mgr);
702
703 ref.reload(UnaryTestsF64::REFTRANS1_F64_ID,mgr);
704
705 output.create(ref.nbSamples(),UnaryTestsF64::OUT_F64_ID,mgr);
706 a.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPA_F64_ID,mgr);
707 break;
708
709 case TEST_MAT_INVERSE_F64_5:
710 input1.reload(UnaryTestsF64::INPUTSINV_F64_ID,mgr);
711 dims.reload(UnaryTestsF64::DIMSINVERT1_S16_ID,mgr);
712
713 ref.reload(UnaryTestsF64::REFINV1_F64_ID,mgr);
714
715 output.create(ref.nbSamples(),UnaryTestsF64::OUT_F64_ID,mgr);
716 a.create(ref.nbSamples(),UnaryTestsF64::TMPA_F64_ID,mgr);
717 break;
718
719 case TEST_MAT_CHOLESKY_DPO_F64_6:
720 input1.reload(UnaryTestsF64::INPUTSCHOLESKY1_DPO_F64_ID,mgr);
721 dims.reload(UnaryTestsF64::DIMSCHOLESKY1_DPO_S16_ID,mgr);
722
723 ref.reload(UnaryTestsF64::REFCHOLESKY1_DPO_F64_ID,mgr);
724
725 output.create(ref.nbSamples(),UnaryTestsF64::OUT_F64_ID,mgr);
726 a.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPA_F64_ID,mgr);
727 break;
728
729 case TEST_SOLVE_UPPER_TRIANGULAR_F64_7:
730 input1.reload(UnaryTestsF64::INPUT_MAT_UTSOLVE_F64_ID,mgr);
731 input2.reload(UnaryTestsF64::INPUT_VEC_LTSOLVE_F64_ID,mgr);
732 dims.reload(UnaryTestsF64::DIM_LTSOLVE_F64_ID,mgr);
733
734 ref.reload(UnaryTestsF64::REF_UT_SOLVE_F64_ID,mgr);
735
736 output.create(ref.nbSamples(),UnaryTestsF64::OUT_F64_ID,mgr);
737 a.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPA_F64_ID,mgr);
738 b.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPB_F64_ID,mgr);
739 break;
740
741 case TEST_SOLVE_LOWER_TRIANGULAR_F64_8:
742 input1.reload(UnaryTestsF64::INPUT_MAT_LTSOLVE_F64_ID,mgr);
743 input2.reload(UnaryTestsF64::INPUT_VEC_LTSOLVE_F64_ID,mgr);
744 dims.reload(UnaryTestsF64::DIM_LTSOLVE_F64_ID,mgr);
745
746 ref.reload(UnaryTestsF64::REF_LT_SOLVE_F64_ID,mgr);
747
748 output.create(ref.nbSamples(),UnaryTestsF64::OUT_F64_ID,mgr);
749 a.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPA_F64_ID,mgr);
750 b.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPB_F64_ID,mgr);
751 break;
752
753 case TEST_MAT_LDL_F64_9:
754 // Definite positive test
755 input1.reload(UnaryTestsF64::INPUTSCHOLESKY1_DPO_F64_ID,mgr);
756 dims.reload(UnaryTestsF64::DIMSCHOLESKY1_DPO_S16_ID,mgr);
757
758 outputll.create(input1.nbSamples(),UnaryTestsF64::LL_F64_ID,mgr);
759 outputd.create(input1.nbSamples(),UnaryTestsF64::D_F64_ID,mgr);
760 outputp.create(input1.nbSamples(),UnaryTestsF64::PERM_S16_ID,mgr);
761
762 outputa.create(input1.nbSamples(),UnaryTestsF64::OUTA_F64_ID,mgr);
763 outputb.create(input1.nbSamples(),UnaryTestsF64::OUTA_F64_ID,mgr);
764
765 a.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPA_F64_ID,mgr);
766
767 tmpapat.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPDB_F64_ID,mgr);
768 tmpbpat.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPDC_F64_ID,mgr);
769 tmpcpat.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPDD_F64_ID,mgr);
770
771 break;
772
773 case TEST_MAT_LDL_F64_10:
774 // Semi definite positive test
775 input1.reload(UnaryTestsF64::INPUTSCHOLESKY1_SDPO_F64_ID,mgr);
776 dims.reload(UnaryTestsF64::DIMSCHOLESKY1_SDPO_S16_ID,mgr);
777
778 outputll.create(input1.nbSamples(),UnaryTestsF64::LL_F64_ID,mgr);
779 outputd.create(input1.nbSamples(),UnaryTestsF64::D_F64_ID,mgr);
780 outputp.create(input1.nbSamples(),UnaryTestsF64::PERM_S16_ID,mgr);
781
782 outputa.create(input1.nbSamples(),UnaryTestsF64::OUTA_F64_ID,mgr);
783 outputb.create(input1.nbSamples(),UnaryTestsF64::OUTA_F64_ID,mgr);
784
785 a.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPA_F64_ID,mgr);
786
787 tmpapat.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPDB_F64_ID,mgr);
788 tmpbpat.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPDC_F64_ID,mgr);
789 tmpcpat.create(MAXMATRIXDIM*MAXMATRIXDIM,UnaryTestsF64::TMPDD_F64_ID,mgr);
790
791 break;
792
793 case TEST_HOUSEHOLDER_F64_11:
794 input1.reload(UnaryTestsF64::INPUTS_HOUSEHOLDER_F64_ID,mgr);
795 dims.reload(UnaryTestsF64::DIMS_HOUSEHOLDER_S16_ID,mgr);
796 ref.reload(UnaryTestsF64::REF_HOUSEHOLDER_V_F64_ID,mgr);
797 refBeta.reload(UnaryTestsF64::REF_HOUSEHOLDER_BETA_F64_ID,mgr);
798
799
800 output.create(ref.nbSamples(),UnaryTestsF64::TMPA_F64_ID,mgr);
801 outputBeta.create(refBeta.nbSamples(),UnaryTestsF64::TMPB_F64_ID,mgr);
802 break;
803
804
805 case TEST_MAT_QR_F64_12:
806 input1.reload(UnaryTestsF64::INPUTS_QR_F64_ID,mgr);
807 dims.reload(UnaryTestsF64::DIMS_QR_S16_ID,mgr);
808 refTau.reload(UnaryTestsF64::REF_QR_TAU_F64_ID,mgr);
809 refR.reload(UnaryTestsF64::REF_QR_R_F64_ID,mgr);
810 refQ.reload(UnaryTestsF64::REF_QR_Q_F64_ID,mgr);
811
812
813 outputTau.create(refTau.nbSamples(),UnaryTestsF64::TMPA_F64_ID,mgr);
814 outputR.create(refR.nbSamples(),UnaryTestsF64::TMPB_F64_ID,mgr);
815 outputQ.create(refQ.nbSamples(),UnaryTestsF64::TMPC_F64_ID,mgr);
816
817 a.create(47,UnaryTestsF64::TMPC_F64_ID,mgr);
818 b.create(47,UnaryTestsF64::TMPD_F64_ID,mgr);
819 break;
820
821 }
822
823
824
825 }
826
tearDown(Testing::testID_t id,Client::PatternMgr * mgr)827 void UnaryTestsF64::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
828 {
829 (void)id;
830 //output.dump(mgr);
831 (void)mgr;
832 }
833