Edinburgh Speech Tools  2.1-release
matrixb_regression.cc
Go to the documentation of this file.
1 /************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1996,1997 */
6 /* All Rights Reserved. */
7 /* */
8 /* Permission is hereby granted, free of charge, to use and distribute */
9 /* this software and its documentation without restriction, including */
10 /* without limitation the rights to use, copy, modify, merge, publish, */
11 /* distribute, sublicense, and/or sell copies of this work, and to */
12 /* permit persons to whom this work is furnished to do so, subject to */
13 /* the following conditions: */
14 /* 1. The code must retain the above copyright notice, this list of */
15 /* conditions and the following disclaimer. */
16 /* 2. Any modifications must be clearly marked as such. */
17 /* 3. Original authors' names are not deleted. */
18 /* 4. The authors' names are not used to endorse or promote products */
19 /* derived from this software without specific prior written */
20 /* permission. */
21 /* */
22 /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23 /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24 /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25 /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26 /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27 /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28 /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29 /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30 /* THIS SOFTWARE. */
31 /* */
32 /************************************************************************/
33 /* Author: Sergio Oller */
34 /* Date: March 2014 */
35 /************************************************************************/
36 /* */
37 /* Operations with matrices to test the implementation */
38 /* */
39 /************************************************************************/
40 
41 #include <cstdlib>
42 #include "EST_DMatrix.h"
43 
44 using namespace std;
45 
46 int main(void)
47 {
48  EST_DMatrix a(3,4);
49  EST_DMatrix b(4,2);
50  EST_DMatrix c;
51 
52  a(0,0) = 1;
53  a(0,1) = 1.5;
54  a(0,2) = -2;
55  a(0,3) = 1;
56 
57  a(1,0) = 1;
58  a(1,1) = 1.5;
59  a(1,2) = 0;
60  a(1,3) = 3;
61 
62  a(2,0) = 1;
63  a(2,1) = 0;
64  a(2,2) = -2;
65  a(2,3) = -1;
66 
67  b(0,0) = -1;
68  b(0,1) = 0;
69 
70  b(1,0) = 2;
71  b(1,1) = -1;
72 
73  b(1,0) = 0;
74  b(1,1) = -3;
75 
76  b(2,0) = 1.3;
77  b(2,1) = 0;
78  b+=b;
79  b-=(b-2*b);
80  b*=3.0;
81  cout << "Matrix A" << endl
82  << a
83  << "10*A" << endl
84  << 10*a
85  << "A*10" << endl
86  << a*10
87  << "A+A" << endl
88  << a+a
89  << "A-A" << endl
90  << a-a
91  << "Matrix B" << endl
92  << b
93  << "A*B" << endl
94  << a*b
95  << "4*A*B" << endl
96  << 4*a*b
97  << "End of test" << endl;
98  return 0;
99 }
100 
101 
int main(void)