CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

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