CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
testMatrix.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: testMatrix.cc,v 1.3 2003/08/13 20:00:12 garren Exp $
3//
4// This file is a part of the CLHEP - a Class Library for High Energy Physics.
5//
6// This is a small program for testing the classes from the HEP Matrix module.
7//
8
9#include "CLHEP/Matrix/defs.h"
10#include "CLHEP/Matrix/Matrix.h"
11#include "CLHEP/Matrix/SymMatrix.h"
12#include "CLHEP/Matrix/DiagMatrix.h"
13#include "CLHEP/Matrix/Vector.h"
14#include "CLHEP/Random/Random.h"
15#include "CLHEP/Random/JamesRandom.h"
16#include "CLHEP/Random/RandFlat.h"
17#include <iostream>
18#include <iomanip>
19
20using std::cout;
21using std::endl;
22
23using namespace CLHEP;
24
25#define PRINTOUT
26
28 //
29 // test of virtual finctions.
30 //
31 static int dum = 0;
32 dum += m.num_col();
33// return 0;
34 return dum;
35}
36
37//
38// test function
39//
40double neg(double f, int, int) {
41 return -f;
42}
43
44double absf(double f, int, int) {
45 return fabs(f);
46}
47
48double negv(double f, int) {
49 return -f;
50}
51
53 n = m.sub(2,5);
54}
55
56
58 //
59 // complete test of all functions in Matrix.cc
60 //
61 cout << "Starting Matrix tests" << endl;
62 {
63 // Test of HepMatrix()
64 HepMatrix a;
65 }
66
67 {
68 // Test of HepMatrix(p,q)
69 HepMatrix a(3,5);
70 HepMatrix b(4,5,0);
71 cout << "4x5 matrix initialized to zero " << b;
72 HepMatrix c(3,3,1);
73 cout << "3x3 matrix initialized to identity " << c;
74 }
75
76 {
77 // Test of HepMatrix(p,q,Random)
78 HepRandom r;
79 r.setTheSeed(31);
80 HepMatrix a(3,3,r);
81 cout << "3x3 matrix initialized with Random " << a;
82 // Test of HepMatrix(const HepMatrix&);
83 HepMatrix b(a);
84 cout << "matrix initialized to the previous matrix " << b;
85 }
86
87 {
88 // Test of sub matrix
89 HepRandom r;
90 r.setTheSeed(31);
91 HepMatrix a(8,5,r);
92 HepMatrix b = a.sub(2,6,3,5);
93 cout << "8x5 matrix" << a;
94 cout << "sub matrix (2-6 x 3-5 of the previous matrix." << b;
95 HepMatrix c(2,3,0);
96 a.sub(4,3,c);
97 cout << "embedding sub matrix at 4,3" << a;
98 // Test of dsum
99 HepMatrix d(3,2,r);
100 cout << "dsum" << dsum(a,d);
101 }
102
103 {
104 // m += m1;
105 HepRandom r;
106 r.setTheSeed(31);
107 HepMatrix a(5,5,r);
108 HepMatrix b(5,5,r);
109 cout << "a" << a;
110 cout << "b" << b;
111 cout << "a += b" << (a+=b);
112 HepMatrix c;
113 c = a + b;
114 cout << "a + b" << c;
115 }
116
117 {
118 // test of T();
119 HepRandom r;
120 r.setTheSeed(31);
121 HepMatrix a(5,3,r);
122 HepMatrix b = a.T();
123 cout << "a" << a;
124 cout << "a.T" << b;
125 }
126
127 cout << "End of Matrix tests" << endl;
128
129}
130
132 {
133 // Test of HepSymMatrix()
134 HepSymMatrix a;
135 }
136
137 {
138 // Test of HepSymMatrix(p)
139 HepSymMatrix a(3);
140 HepSymMatrix b(4,0);
141 cout << "4x4 Symmetric matrix initialuzed to zero " << b;
142 HepSymMatrix c(3,1);
143 cout << "3x3 Symmetric matrix initialized to identity "<< c;
144 }
145
146 {
147 // Test of HepSymMatrix(p,Random)
148 HepRandom r;
149 r.setTheSeed(31);
150 HepSymMatrix a(3,r);
151 cout << "3x3 symmetric matrix initialized with Random " << a << endl;
152 // Test of HepSymMatrix(const HepSymMatrix&);
153 HepSymMatrix b(a);
154 cout << "symmetric matrix initialized to the previous matrix " << b;
155 HepMatrix c(b);
156 cout << "matrix initialized to the previous symmetric matrix "
157 << c;
158 //
159 // Access to elements
160 //
161 double f = 3.8;
162 double g = 22.5;
163 cout << c(1,1) << " " << c[0][0] << endl;
164 c(1,2) = f;
165 c[2][1] = g;
166 c(2,3) = f;
167 c[1][2] = g;
168 cout << c << endl;
169 HepMatrix &d = c;
170 cout << d(1,1) << " " << d[0][0] << endl;
171
172 }
173
174 {
175 // Test of sub symmatrix
176 HepRandom r;
177 r.setTheSeed(31);
178 HepSymMatrix a(5,r);
179 HepSymMatrix b = a.sub(2,5);
180 cout << "5x5 sym matrix" << a;
181 cout << "sub sym matrix (2-5 x 2-5 of the previous sub matrix." << b;
182 HepSymMatrix c(3,0);
183 a.sub(2,c);
184 cout << "embedding sub matrix at 2" << a;
185 }
186 {
187 // m = m1 + s;
188 HepRandom r;
189 r.setTheSeed(31);
190 HepMatrix a(5,5,r);
191 HepSymMatrix b(5,r);
192 cout << "a" << a;
193 cout << "b(sym)" << b;
194 cout << "a += b" << (a+=b);
195 HepMatrix c = a + b;
196 cout << "a + b" << c;
197 }
198 {
199 // test of similarity(Matrix)
200 HepRandom r;
201 r.setTheSeed(31);
202 HepMatrix a(5,3,r);
203 HepSymMatrix b(3,r);
204 HepSymMatrix c = b.similarity(a);
205 cout << "a" << a;
206 cout << "b" << b;
207 cout << "c" << c;
208 }
209 {
210 // test of similarityT(Matrix)
211 HepRandom r;
212 r.setTheSeed(31);
213 HepMatrix a(3,5,r);
214 HepSymMatrix b(3,r);
215 HepSymMatrix c = b.similarityT(a);
216 cout << "a" << a;
217 cout << "b" << b;
218 cout << "c" << c;
219 }
220 {
221 // test of similarity(SymMatrix)
222 HepRandom r;
223 r.setTheSeed(31);
224 HepSymMatrix a(3,r);
225 HepSymMatrix b(3,r);
226 HepSymMatrix c = b.similarity(a);
227 cout << "a" << a;
228 cout << "b" << b;
229 cout << "c" << c;
230 }
231 {
232 // test of similarity(Vector)
233 HepRandom r;
234 r.setTheSeed(31);
235 HepVector a(3,r);
236 HepSymMatrix b(3,r);
237 double c = b.similarity(a);
238 HepSymMatrix cc = b.similarity(HepMatrix(a.T()));
239 cout << "a" << a;
240 cout << "b" << b;
241 cout << "c\t" << c << endl;
242 cout << "c" << cc;
243 }
244 cout << "End of SymMatrix tests" << endl;
245
246}
247
249 {
250 // Test of HepDiagMatrix()
252 }
253
254 {
255 // Test of HepDiagMatrix(p)
256 HepDiagMatrix a(3);
257 HepDiagMatrix b(4,0);
258 cout << "4x4 diagonal matrix initialized to zero " << b;
259 HepDiagMatrix c(3,1);
260 cout << "3x3 diagonal matrix initialized to identity " << c;
261 }
262
263 {
264 // Test of HepDiagMatrix(p,Random)
265 HepRandom r;
266 r.setTheSeed(31);
267 HepDiagMatrix a(3,r);
268 cout << "3x3 diagonal matrix initialized to Random " << a;
269 // Test of HepDiagMatrix(const HepDiagMatrix&);
270 HepDiagMatrix b(a);
271 cout << "diagonal matrix initialized to the previous matrix " << b;
272 HepMatrix c(b);
273 cout << "matrix initialized to the previous diagonal matrix "
274 << c;
275 HepSymMatrix d(b);
276 cout << "Symmetric matrix initialized to the previous diagonal matrix "
277 << d;
278 }
279
280 {
281 // Test of sub diagmatrix
282 HepRandom r;
283 r.setTheSeed(31);
284 HepDiagMatrix a(8,r);
285 HepDiagMatrix b = a.sub(2,5);
286 cout << "8x8 diag matrix" << a;
287 cout << "sub diag matrix (2-5 x 2-5 of the previous diag matrix." << b;
288 HepDiagMatrix c(3,0);
289 a.sub(2,c);
290 cout << "embedding sub matrix at 2" << a;
291 }
292 {
293 // m = m1 + s;
294 HepRandom r;
295 r.setTheSeed(31);
296 HepMatrix a(5,5,r);
297 HepDiagMatrix b(5,r);
298 cout << "a" << a;
299 cout << "b(diag)" << b;
300 cout << "a += b" << (a+=b);
301 HepMatrix c = a + b;
302 cout << "a + b" << c;
303 }
304
305 cout << "End of DiagMatrix tests" << endl;
306}
307
309 {
310 // Test of HepVector()
311 HepVector a;
312 }
313
314 {
315 // Test of HepVector(p)
316 HepVector a(3);
317 HepVector b(4,0);
318 cout << "4 vector initialized to zero "<< b;
319 HepVector c(3,1);
320 cout << "3 vector initialized to identity " << c;
321 }
322
323 {
324 // Test of HepVector(p,Random)
325 HepRandom r;
326 r.setTheSeed(31);
327 HepVector a(3,r);
328 cout << "3 vector initialized to Random " << a;
329 // Test of HepVector(const HepVector&);
330 HepVector b(a);
331 cout << "Vector initialized to the previous vector " << b;
332 HepMatrix c(b);
333 cout << "matrix initialized to the previous vector "
334 << c;
335 HepVector d(c);
336 cout << "Vector initialized to the previous matrix "
337 << d;
338 }
339
340 {
341 // Test of sub diagmatrix
342 HepRandom r;
343 r.setTheSeed(31);
344 HepVector a(8,r);
345 HepVector b = a.sub(2,5);
346 cout << "8 vector" << a;
347 cout << "sub vector (2-5 of the previous vector." << b;
348 HepVector c(3,0);
349 a.sub(2,c);
350 cout << "embedding sub vector at 2 " << a;
351 }
352 {
353 // m = m1 + s;
354 HepRandom r;
355 r.setTheSeed(31);
356 HepMatrix a(5,1,r);
357 HepVector b(5,r);
358 cout << "a" << a;
359 cout << "b(vector)" << b;
360 cout << "a += b" << (a+=b);
361 HepMatrix c = a + b;
362 cout << "a + b" << c;
363 }
364
365 cout << "End of Vector tests" << endl;
366}
367
368int main() {
369//
370// Test of HepMatrix
371//
372 cout << std::setiosflags(std::ios::fixed) << std::setw(10);
373 matrix_test();
376 vector_test();
377
378 //
379 // Test of default constructor
380 //
381 HepMatrix m;
382 //
383 // Test of constructors.
384 //
385 HepMatrix d(3,3,1);
386 HepMatrix e(3,3,0);
387 HepMatrix f(5,3);
388 HepMatrix g(f);
390 //
391 // Test of constructor with a Random object.
392 //
393 HepRandom r;
394 r.setTheSeed(31);
395 HepMatrix a(3,3,r);
396#if defined(PRINTOUT)
397 cout << a << endl;
398#endif
399 HepMatrix b(3,5,r);
400 matrix_test1(b);
401#if defined(PRINTOUT)
402 cout << b << endl;
403#endif
404
405 HepSymMatrix dds(3,r);
406 HepMatrix ddm(dds);
407 HepDiagMatrix ddd(3,r);
408 HepMatrix ddmd(ddd);
409 HepVector ddv(3,r);
410 HepMatrix ddmv(ddv);
411#if defined(PRINTOUT)
412 cout << "nraw=" << b.num_row() << " ncol=" << b.num_col() << endl;
413#endif
414#if defined(PRINTOUT)
415 cout << "b(1,1)=" << b(1,1) << " b(2,1)=" << b(2,1) << endl;
416#endif
417 b(2,3) = 1.0;
418
419 b /= 3.0;
420 b *= 6.0;
421
422 HepSymMatrix sm(3,r);
423 HepDiagMatrix dm(3,r);
424 HepVector vvm(3,r);
425
426 d += e;
427 d += sm;
428 d += dm;
429 ddmv += vvm;
430
431 a -= e;
432 a -= sm;
433 a -= dm;
434 ddmv -= vvm;
435
436 d = sm;
437 d = dm;
438 d = a;
439 ddmv = vvm;
440
441 e = d.apply(neg);
442
443 a = d.T();
444
445 e = b.sub(1,2,3,2);
446
447 b.sub(1,3,e);
448
449 swap(a,d);
450
451 m = d * a;
452 m = d * sm;
453 m = d * dm;
454 m = sm * d;
455#if defined(PRINTOUT)
456 cout << "Dm=" << dm << " d = " << d << endl;
457#endif
458 m = dm * d;
459 m = sm * sm;
460 m = dm * dm;
461
462 //
463 // SymMatrix
464 //
465 HepSymMatrix s;
466 HepSymMatrix ss(6);
467 HepSymMatrix si(6,1);
468 HepSymMatrix sz(6,0);
469 HepSymMatrix sr(6,r);
470 HepSymMatrix sc(sr);
471 HepSymMatrix scd(dm);
472
473 matrix_test1(si);
474#if defined(PRINTOUT)
475 cout << "nraw=" << sr.num_row() << " ncol=" << sr.num_col() << endl;
476#endif
477#if defined(PRINTOUT)
478 cout << "sr(1,1)=" << sr(1,1) << " sr(2,1)=" << sr(2,1) << endl;
479#endif
480
481 sr(4,3) = r();
482 sr.fast(3,1) = r();
483
484 s.assign(d);
485#if defined(PRINTOUT)
486 cout << "d=" << d << "s=" << s << endl;
487#endif
488 ss.assign(sc);
489
490 ss *= 0.5;
491 ss /= 0.2;
492
493 HepDiagMatrix ddds(ss.num_row(),r);
494 ss += si;
495 ss += ddds;
496 ss -= sr;
497 ss -= ddds;
498 ss = ddds;
499
500 s = sr;
501 s = ss.T();
502 s.apply(neg);
503 HepMatrix mm(6,4,r);
504 ss = s.similarityT(mm);
505
506 HepMatrix mt(8,6,r);
507 ss = s.similarity(mt);
508
509 s.assign(d);
510
511 s = sr.sub(2,5);
512
513 ss.sub(2,s);
514 s = ss.sub(2,7);
515
516 m = s * sr;
517 m = s * m;
518 m = m * s;
519
520 HepVector v(6,r);
521 s = vT_times_v(v);
522
523 //
524 // Test of HepDiagMatrix
525 //
526
527 HepDiagMatrix dt;
528 HepDiagMatrix dn(6);
529 HepDiagMatrix di(6,1);
530 HepDiagMatrix dz(6,0);
531 HepDiagMatrix dr(6,r);
532 HepDiagMatrix dc(dr);
533
534 matrix_test1(dr);
535#if defined(PRINTOUT)
536 cout << "Nr=" << di.num_row() << " Nc=" << dz.num_col() << endl;
537#endif
538#if defined(PRINTOUT)
539 cout << "dr(1,1)=" << dr(1,1) << endl;
540#endif
541
542 dr(4,4) = r();
543 dr.fast(2,2) = r();
544
545 dt.assign(m);
546 dt.assign(s);
547 dt.assign(dc);
548
549 dr *= 3.0;
550 dr /= 3.0;
551
552 dr += dt;
553 dr -= di;
554
555 dt = dz;
556
557 dz = dt.T();
558 di = dt.apply(neg);
559
560 s = dr.similarityT(mm);
561 s = dr.similarity(mt);
562#if defined(PRINTOUT)
563 cout << "sim=" << dr.similarity(v);
564#endif
565
566 dt = dr.sub(2,5);
567 dz.sub(3,dt);
568
569 //
570 // Test of HepVector
571 //
572
573 HepVector vt;
574 HepVector vp(6);
575 HepVector vz(6,0);
576 HepVector vi(6,1);
577 HepVector vr(6,r);
578 HepVector vc(vr);
579#if defined(PRINTOUT)
580 cout << "vz=" << vz << "vi=" << vi << endl;
581#endif
582
583 HepVector vm(HepMatrix(6,1,r));
584 HepVector vs(HepSymMatrix(1,r));
585 HepVector vd(HepDiagMatrix(1,r));
586#if defined(PRINTOUT)
587 cout << "Nr=" << vr.num_row() << endl;
588#endif
589#if defined(PRINTOUT)
590 cout << "vr(3)=" << vr(3) << endl;
591#endif
592
593 vr(2) = r();
594
595 vi *= 2.5;
596 vi /= 2.5;
597
598 vm += HepMatrix(6,1,r);
599 vs += HepSymMatrix(1,r);
600 vd += HepDiagMatrix(1,r);
601 vi += vr;
602
603 vm -= HepMatrix(6,1,r);
604 vs -= HepSymMatrix(1,r);
605 vd -= HepDiagMatrix(1,r);
606 vi -= vc;
607
608 vm = HepMatrix(6,1,r);
609 vs = HepSymMatrix(1,r);
610 vd = HepDiagMatrix(1,r);
611 vt = vc;
612
613 vt = vc.apply(negv);
614 vt = vc.sub(2,5);
615 vc.sub(3,vt);
616#if defined(PRINTOUT)
617 cout << "Normsq=" << vc.normsq() << "Norm=" << vc.norm() << endl;
618#endif
619
620 m = vc.T();
621
622 swap(vc,vr);
623
624 vt = sr * vr;
625 vt = dr * vr;
626 vt = mt * vr;
627 f = vr * m;
628
629 //
630 // Test of other operators
631 //
632
633 f = 3.5 * m;
634 s = 3.5 * ss;
635 dt = 3.5 * dr;
636 vt = 3.5 * vr;
637
638 f = m * 3.6;
639 s = ss * 3.6;
640 dt = dr * 3.6;
641 vt = vr * 3.6;
642
643 f = m / 3.6;
644 s = ss / 3.6;
645 dt = dr / 3.6;
646 vt = vr / 3.6;
647
648 d = HepMatrix(6,3,r);
649 e = HepMatrix(6,3,r);
650 m = d + e;
651 d = HepMatrix(6,6,r);
652 m = d + sr;
653 m = d + dr;
654
655 m = sr + d;
656 m = dr + d;
657
658 s = sr + si;
659 dt = dr + di;
660
661 s = dr + sr;
662 s = sr + dr;
663
664 e = HepMatrix(6,1,r);
665
666 v = e + vr;
667
668 v = vr + e;
669
670 v = vr + vz;
671
672
673 d = HepMatrix(6,3,r);
674 e = HepMatrix(6,3,r);
675 m = d - e;
676 d = HepMatrix(6,6,r);
677 dr = HepDiagMatrix(6,r);
678 m = d - sr;
679 m = d - dr;
680
681 m = sr - d;
682 m = dr - d;
683
684 s = sr - si;
685 dt = dr - di;
686
687 s = dr - sr;
688 s = sr - dr;
689
690 e = HepMatrix(6,1,r);
691
692 v = e - vr;
693
694 v = vr - e;
695
696 v = vr - vz;
697
698 //
699 // Test of Matrix inversion
700 //
701
702 m = HepMatrix(6,6,r);
703// a = m;
704 int inv;
705 a = m.inverse(inv);
706#if defined(PRINTOUT)
707 cout << "Inv=" << inv << endl;
708#endif
709 if(inv==0) {
710#if defined(PRINTOUT)
711 HepMatrix am(a * m), ma(m * a);
712 cout << "a*m=" << am.apply(absf) << "m*a=" << ma.apply(absf) << endl;
713#endif
714 }
715
716 v = HepVector(6,r);
717
718 vt = solve(m, v);
719#if defined(PRINTOUT)
720 cout << "m*vt=" << m*vt << "v=" << v << endl;
721#endif
722
723
724 ss = HepSymMatrix(6,r);
725// s = ss;
726 s = ss.inverse(inv);
727#if defined(PRINTOUT)
728 cout << "Inv=" << inv << endl;
729#endif
730 if(inv==0) {
731#if defined(PRINTOUT)
732 HepMatrix sss(s*ss), ssss(ss*s);
733 cout << sss.apply(absf) << ssss.apply(absf) << endl;
734#endif
735 }
736
737#if defined(PRINTOUT)
738 cout << "Before diag:ss=" << ss << endl;
739 s = ss;
740#endif
741 m = diagonalize(&ss);
742#if defined(PRINTOUT)
743 cout << "m=" << m << endl;
744#endif
745#if defined(PRINTOUT)
746 cout << "ss=" << ss << endl;
747 cout << "Sim" << ss.similarity(m) << endl;
748 HepSymMatrix diff(ss.similarity(m) - s);
749 cout << "Diff" << diff.apply(absf) << endl;
750#endif
751
752 m = HepMatrix(6,6,r);
753 a = qr_inverse(m);
754#if defined(PRINTOUT)
755 HepMatrix am(a * m), ma(m * a);
756 cout << am.apply(absf) << ma.apply(absf) << endl;
757#endif
758#if defined(PRINTOUT)
759 cout << "Norm 1 =" << norm1(m) << endl;
760#endif
761#if defined(PRINTOUT)
762 cout << "Norm 2 =" << norm(m) << endl;
763#endif
764#if defined(PRINTOUT)
765 cout << "Norm i =" << norm_infinity(m) << endl;
766#endif
767
768 m = HepMatrix(8,6,r);
769#if defined(PRINTOUT)
770 cout << "m=" << m << endl;
771#endif
772 a = qr_decomp(&m);
773#if defined(PRINTOUT)
774 cout << "a=" << a << "m=" << m << endl;
775#endif
776#if defined(PRINTOUT)
777 cout << "a*m=" << a*m << endl;
778#endif
779
780 m = HepMatrix(8,8,r);
781 v = HepVector(8,r);
782 vt = qr_solve(m,v);
783#if defined(PRINTOUT)
784 cout << "v=" << v << " m*vt=" << m*vt << endl;
785#endif
786
787 m = HepMatrix(8,8,r);
788 a = HepMatrix(8,3,r);
789 b = qr_solve(m,a);
790#if defined(PRINTOUT)
791 cout << "v=" << a << " m*b=" << m*b << endl;
792#endif
793#if defined(PRINTOUT)
794 cout << "Test was successful" << endl;
795#endif
796
797 //
798 // Some useful things it can do.
799 //
800 // Spherisity
801// HepUniformRandomAB ab(-1,1);
802 HepJamesRandom Myengine;
803 RandFlat ab(Myengine);
804 HepVector p[10];
805 int i;
806 for(i=0;i<10;i++) {
807 p[i] = HepVector(3,ab);
808 p[i] *= 2.0;
809 p[i](1) -= 1;
810 p[i](2) -= 1;
811 p[i](3) -= 1;
812 }
813 HepSymMatrix sp(3,0);
814 for(i=0;i<10;i++) {
815 double psq = p[i].normsq();
816 sp(1,1) += psq - p[i](1)*p[i](1);
817 sp(2,2) += psq - p[i](2)*p[i](2);
818 sp(3,3) += psq - p[i](3)*p[i](3);
819 sp(2,1) -= p[i](2)*p[i](1);
820 sp(3,1) -= p[i](3)*p[i](1);
821 sp(3,2) -= p[i](3)*p[i](2);
822 }
823 HepMatrix spd = diagonalize(&sp);
824 cout << "sp=" << sp << " spd=" << spd << endl;
825 HepSymMatrix spps(7,r);
826 HepSymMatrix sppss(spps);
827 cout << "condition = " << condition(spps) << endl;
828 HepMatrix sb = diagonalize(&spps);
829 HepSymMatrix sppssdiff(sppss - spps.similarity(sb));
830 cout << "spps=" << spps << "sppss - sim = " << sppssdiff.apply(absf)
831 << endl;
832 return 0;
833}
834
HepDiagMatrix T() const
double & fast(int row, int col)
HepDiagMatrix sub(int min_row, int max_row) const
Definition: DiagMatrix.cc:118
void assign(const HepMatrix &hm2)
Definition: DiagMatrix.cc:598
HepSymMatrix similarityT(const HepMatrix &hm1) const
Definition: DiagMatrix.cc:671
HepSymMatrix similarity(const HepMatrix &hm1) const
Definition: DiagMatrix.cc:628
HepDiagMatrix apply(double(*f)(double, int, int)) const
Definition: DiagMatrix.cc:582
virtual int num_col() const =0
HepMatrix sub(int min_row, int max_row, int min_col, int max_col) const
Definition: Matrix.cc:193
HepMatrix apply(double(*f)(double, int, int)) const
Definition: Matrix.cc:474
virtual int num_col() const
Definition: Matrix.cc:120
virtual int num_row() const
Definition: Matrix.cc:118
HepMatrix T() const
Definition: Matrix.cc:454
HepMatrix inverse(int &ierr) const
static void setTheSeed(long seed, int lxr=3)
Definition: Random.cc:236
int num_row() const
int num_col() const
void assign(const HepMatrix &hm2)
Definition: SymMatrix.cc:715
HepSymMatrix apply(double(*f)(double, int, int)) const
Definition: SymMatrix.cc:697
HepSymMatrix T() const
HepSymMatrix similarityT(const HepMatrix &hm1) const
Definition: SymMatrix.cc:813
HepSymMatrix sub(int min_row, int max_row) const
Definition: SymMatrix.cc:131
HepSymMatrix inverse(int &ifail) const
HepSymMatrix similarity(const HepMatrix &hm1) const
Definition: SymMatrix.cc:734
const double & fast(int row, int col) const
HepVector sub(int min_row, int max_row) const
Definition: Vector.cc:150
HepMatrix T() const
Definition: Vector.cc:530
HepVector apply(double(*f)(double, int)) const
Definition: Vector.cc:555
double norm() const
virtual int num_row() const
Definition: Vector.cc:116
double normsq() const
void f(void g())
Definition: excDblThrow.cc:38
HepVector qr_solve(const HepMatrix &A, const HepVector &b)
HepSymMatrix vT_times_v(const HepVector &v)
Definition: SymMatrix.cc:539
double norm(const HepGenMatrix &m)
Definition: GenMatrix.cc:54
HepMatrix qr_inverse(const HepMatrix &A)
void qr_decomp(HepMatrix *A, HepMatrix *hsm)
double norm1(const HepGenMatrix &m)
Definition: GenMatrix.cc:43
HepDiagMatrix dsum(const HepDiagMatrix &s1, const HepDiagMatrix &s2)
Definition: DiagMatrix.cc:161
double norm_infinity(const HepGenMatrix &m)
Definition: GenMatrix.cc:31
double condition(const HepSymMatrix &m)
HepMatrix diagonalize(HepSymMatrix *s)
HepVector solve(const HepMatrix &, const HepVector &)
Definition: Vector.cc:575
double absf(double f, int, int)
Definition: testMatrix.cc:44
void diagmatrix_test()
Definition: testMatrix.cc:248
void symmatrix_test()
Definition: testMatrix.cc:131
void matrix_test2(const HepSymMatrix &m, HepSymMatrix &n)
Definition: testMatrix.cc:52
void vector_test()
Definition: testMatrix.cc:308
void matrix_test()
Definition: testMatrix.cc:57
double neg(double f, int, int)
Definition: testMatrix.cc:40
double negv(double f, int)
Definition: testMatrix.cc:48
int main()
Definition: testMatrix.cc:368
int matrix_test1(const HepGenMatrix &m)
Definition: testMatrix.cc:27
int g(shared_ptr< X >)