annotate main/fixed/src/fixedCRowVector.cc @ 9481:d84d2fea3c90 octave-forge

Re-enable compilation of fixed package
author jordigh
date Wed, 22 Feb 2012 22:07:33 +0000
parents f8d77845533f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1 // Fixed Point RowVector manipulations.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
2 /*
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
3
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
4 Copyright (C) 2003 Motorola Inc
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
5 Copyright (C) 2003 David Bateman
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
6
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
7 This program is free software; you can redistribute it and/or modify it
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
10 later version.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
11
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
12 This program is distributed in the hope that it will be useful, but WITHOUT
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
15 for more details.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
16
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
4404
2de537641f94 More copyright updates
adb014
parents: 3272
diff changeset
18 along with this program; see the file COPYING. If not, see
2de537641f94 More copyright updates
adb014
parents: 3272
diff changeset
19 <http://www.gnu.org/licenses/>.
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
20
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
21 In addition to the terms of the GPL, you are permitted to link
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
22 this program with any Open Source program, as defined by the
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
23 Open Source Initiative (www.opensource.org)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
24
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
25 */
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
26
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
27 #include <iostream>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
28
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
29 #include <octave/config.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
30 #include <octave/lo-utils.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
31 #include <octave/lo-error.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
32 #include <octave/error.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
33 #include <octave/gripes.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
34 #include <octave/ops.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
35
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
36 #include "fixedCMatrix.h"
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
37 #include "fixedCColVector.h"
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
38 #include "fixedCRowVector.h"
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
39
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
40 // Fixed Point Complex Row Vector class
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
41
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
42 FixedComplexRowVector::FixedComplexRowVector (const MArray<int> &is,
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
43 const MArray<int> &ds) : MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
44 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
45 if (length() != ds.length()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
46 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
47 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
48 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
49
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
50 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
51 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
52 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
53
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
54 FixedComplexRowVector::FixedComplexRowVector (const RowVector &is,
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
55 const RowVector &ds) : MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
56 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
57 if (length() != ds.length()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
58 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
59 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
60 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
61
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
62 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
63 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
64 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
65
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
66 FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is,
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
67 const ComplexRowVector &ds) : MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
68 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
69 if (length() != ds.length()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
70 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
71 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
72 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
73
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
74 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
75 elem (i) = FixedPointComplex(is(i), ds(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
76 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
77
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
78 FixedComplexRowVector::FixedComplexRowVector (unsigned int is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
79 unsigned int ds, const FixedComplexRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
80 MArray<FixedPointComplex> (dim_vector (1, a.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
81 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
82 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
83 elem (i) = FixedPointComplex(is, ds, a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
84 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
85
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
86 FixedComplexRowVector::FixedComplexRowVector (Complex is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
87 Complex ds, const FixedComplexRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
88 MArray<FixedPointComplex> (dim_vector (1, a.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
89 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
90 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
91 elem (i) = FixedPointComplex(is, ds, a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
92 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
93
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
94 FixedComplexRowVector::FixedComplexRowVector (const MArray<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
95 const MArray<int> &ds, const FixedComplexRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
96 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
97 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
98 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
99 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
100 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
101 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
102
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
103 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
104 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
105 a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
106 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
107
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
108 FixedComplexRowVector::FixedComplexRowVector (const RowVector &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
109 const RowVector &ds, const FixedComplexRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
110 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
111 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
112 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
113 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
114 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
115 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
116
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
117 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
118 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
119 a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
120 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
121
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
122 FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
123 const ComplexRowVector &ds, const FixedComplexRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
124 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
125 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
126 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
127 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
128 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
129 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
130
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
131 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
132 elem (i) = FixedPointComplex(is(i), ds(i), a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
133 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
134
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
135 FixedComplexRowVector::FixedComplexRowVector (unsigned int is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
136 unsigned int ds, const FixedRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
137 MArray<FixedPointComplex> (dim_vector (1, a.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
138 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
139 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
140 elem (i) = FixedPointComplex(is, ds, a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
141 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
142
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
143 FixedComplexRowVector::FixedComplexRowVector (Complex is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
144 Complex ds, const FixedRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
145 MArray<FixedPointComplex> (dim_vector (1, a.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
146 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
147 for (int i = 0; i < length (); i++)
3071
fa041e4681b4 Fix MSVC compilation.
goffioul
parents: 2394
diff changeset
148 elem (i) = FixedPointComplex(is, ds, FixedPointComplex(a(i)));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
149 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
150
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
151 FixedComplexRowVector::FixedComplexRowVector (const MArray<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
152 const MArray<int> &ds, const FixedRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
153 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
154 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
155 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
156 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
157 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
158 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
159
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
160 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
161 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
162 a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
163 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
164
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
165 FixedComplexRowVector::FixedComplexRowVector (const RowVector &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
166 const RowVector &ds, const FixedRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
167 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
168 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
169 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
170 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
171 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
172 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
173
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
174 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
175 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
176 a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
177 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
178
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
179 FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
180 const ComplexRowVector &ds, const FixedRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
181 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
182 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
183 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
184 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
185 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
186 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
187
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
188 for (int i = 0; i < length (); i++)
3071
fa041e4681b4 Fix MSVC compilation.
goffioul
parents: 2394
diff changeset
189 elem (i) = FixedPointComplex(is(i), ds(i), FixedPointComplex(a(i)));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
190 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
191
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
192 FixedComplexRowVector::FixedComplexRowVector (unsigned int is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
193 unsigned int ds, const ComplexRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
194 MArray<FixedPointComplex> (dim_vector (1, a.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
195 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
196 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
197 elem (i) = FixedPointComplex(is, ds, a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
198 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
199
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
200 FixedComplexRowVector::FixedComplexRowVector (Complex is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
201 Complex ds, const ComplexRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
202 MArray<FixedPointComplex> (dim_vector (1, a.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
203 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
204 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
205 elem (i) = FixedPointComplex(is, ds, a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
206 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
207
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
208 FixedComplexRowVector::FixedComplexRowVector (const MArray<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
209 const MArray<int> &ds, const ComplexRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
210 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
211 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
212 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
213 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
214 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
215 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
216
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
217 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
218 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
219 a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
220 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
221
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
222 FixedComplexRowVector::FixedComplexRowVector (const RowVector &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
223 const RowVector &ds, const ComplexRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
224 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
225 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
226 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
227 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
228 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
229 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
230
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
231 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
232 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
233 a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
234 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
235
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
236 FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
237 const ComplexRowVector &ds, const ComplexRowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
238 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
239 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
240 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
241 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
242 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
243 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
244
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
245 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
246 elem (i) = FixedPointComplex(is(i), ds(i), a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
247 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
248
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
249 FixedComplexRowVector::FixedComplexRowVector (unsigned int is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
250 unsigned int ds, const RowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
251 MArray<FixedPointComplex> (dim_vector (1, a.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
252 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
253 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
254 elem (i) = FixedPointComplex(is, ds, a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
255 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
256
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
257 FixedComplexRowVector::FixedComplexRowVector (Complex is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
258 Complex ds, const RowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
259 MArray<FixedPointComplex> (dim_vector (1, a.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
260 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
261 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
262 elem (i) = FixedPointComplex(is, ds, a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
263 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
264
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
265 FixedComplexRowVector::FixedComplexRowVector (const MArray<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
266 const MArray<int> &ds, const RowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
267 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
268 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
269 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
270 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
271 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
272 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
273
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
274 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
275 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
276 a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
277 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
278
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
279 FixedComplexRowVector::FixedComplexRowVector (const RowVector &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
280 const RowVector &ds, const RowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
281 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
282 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
283 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
284 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
285 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
286 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
287
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
288 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
289 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
290 a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
291 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
292
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
293 FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
294 const ComplexRowVector &ds, const RowVector& a) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
295 MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
296 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
297 if ((length() != ds.length()) || (length() != a.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
298 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
299 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
300 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
301
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
302 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
303 elem (i) = FixedPointComplex(is(i), ds(i), a(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
304 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
305
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
306 FixedComplexRowVector::FixedComplexRowVector (unsigned int is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
307 unsigned int ds, const ComplexRowVector& a,
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
308 const ComplexRowVector& b) : MArray<FixedPointComplex> (dim_vector (1, a.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
309 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
310 if (length() != b.length()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
311 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
312 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
313 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
314
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
315 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
316 elem (i) = FixedPointComplex(is, ds, a(i), b(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
317 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
318
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
319 FixedComplexRowVector::FixedComplexRowVector (Complex is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
320 Complex ds, const ComplexRowVector& a, const ComplexRowVector& b) :
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
321 MArray<FixedPointComplex> (dim_vector (1, a.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
322 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
323 if (length() != b.length()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
324 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
325 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
326 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
327
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
328 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
329 elem (i) = FixedPointComplex(is, ds, a(i), b(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
330 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
331
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
332 FixedComplexRowVector::FixedComplexRowVector (const MArray<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
333 const MArray<int> &ds, const ComplexRowVector& a,
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
334 const ComplexRowVector& b) : MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
335 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
336 if ((length() != ds.length()) || (length() != a.length()) ||
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
337 (length() != b.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
338 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
339 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
340 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
341
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
342 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
343 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
344 a(i), b(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
345 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
346
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
347 FixedComplexRowVector::FixedComplexRowVector (const RowVector &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
348 const RowVector &ds, const ComplexRowVector& a,
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
349 const ComplexRowVector& b) : MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
350 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
351 if ((length() != ds.length()) || (length() != a.length()) ||
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
352 (length() != b.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
353 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
354 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
355 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
356
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
357 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
358 elem (i) = FixedPointComplex((unsigned int)is(i), (unsigned int)ds(i),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
359 a(i), b(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
360 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
361
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
362 FixedComplexRowVector::FixedComplexRowVector (const ComplexRowVector &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
363 const ComplexRowVector &ds, const ComplexRowVector& a,
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
364 const ComplexRowVector& b) : MArray<FixedPointComplex> (dim_vector (1, is.length()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
365 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
366 if ((length() != ds.length()) || (length() != a.length()) ||
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
367 (length() != b.length())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
368 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
369 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
370 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
371
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
372 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
373 elem (i) = FixedPointComplex(is(i), ds(i), a(i), b(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
374 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
375
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
376 #define GET_FIXED_PROP(METHOD) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
377 ComplexRowVector \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
378 FixedComplexRowVector:: METHOD (void) const \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
379 { \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
380 int len = length(); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
381 ComplexRowVector retval(len); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
382 for (int i = 0; i < len; i++) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
383 retval(i) = elem(i) . METHOD (); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
384 return retval; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
385 } \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
386
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
387 GET_FIXED_PROP(sign);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
388 GET_FIXED_PROP(getdecsize);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
389 GET_FIXED_PROP(getintsize);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
390 GET_FIXED_PROP(getnumber);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
391 GET_FIXED_PROP(fixedpoint);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
392
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
393 #undef GET_FIXED_PROP
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
394
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
395 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
396 FixedComplexRowVector::chdecsize (const Complex n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
397 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
398 int len = length();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
399 FixedComplexRowVector retval(len);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
400
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
401 for (int i = 0; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
402 retval(i) = FixedPointComplex(elem(i).getintsize(), n, elem(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
403
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
404 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
405 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
406
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
407 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
408 FixedComplexRowVector::chdecsize (const ComplexRowVector &n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
409 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
410 int len = length();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
411
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
412 if (len != n.length()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
413 (*current_liboctave_error_handler) ("vector size mismatch in chdecsize");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
414 return FixedComplexRowVector();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
415 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
416
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
417 FixedComplexRowVector retval(len);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
418
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
419 for (int i = 0; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
420 retval(i) = FixedPointComplex(elem(i).getintsize(), n(i), elem(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
421
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
422 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
423 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
424
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
425 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
426 FixedComplexRowVector::chintsize (const Complex n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
427 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
428 int len = length();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
429 FixedComplexRowVector retval(len);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
430
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
431 for (int i = 0; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
432 retval(i) = FixedPointComplex(n, elem(i).getdecsize(), elem(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
433
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
434 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
435 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
436
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
437 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
438 FixedComplexRowVector::chintsize (const ComplexRowVector &n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
439 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
440 int len = length();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
441
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
442 if (len != n.length()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
443 (*current_liboctave_error_handler) ("vector size mismatch in chdecsize");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
444 return FixedComplexRowVector();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
445 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
446
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
447 FixedComplexRowVector retval(len);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
448
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
449 for (int i = 0; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
450 retval(i) = FixedPointComplex(n(i), elem(i).getdecsize(), elem(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
451
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
452 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
453 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
454
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
455 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
456 FixedComplexRowVector::incdecsize (const Complex n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
457 return chdecsize(n + getdecsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
458 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
459
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
460 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
461 FixedComplexRowVector::incdecsize (const ComplexRowVector &n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
462 if (n.length() != length()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
463 (*current_liboctave_error_handler) ("vector size mismatch in incdecsize");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
464 return FixedComplexRowVector();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
465 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
466 return chdecsize(n + getdecsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
467 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
468
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
469 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
470 FixedComplexRowVector::incdecsize () {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
471 return chdecsize(Complex (1) + getdecsize());
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
472 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
473
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
474 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
475 FixedComplexRowVector::incintsize (const Complex n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
476 return chintsize(n + getintsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
477 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
478
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
479 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
480 FixedComplexRowVector::incintsize (const ComplexRowVector &n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
481 if (n.length() != length()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
482 (*current_liboctave_error_handler) ("vector size mismatch in incintsize");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
483 return FixedComplexRowVector();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
484 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
485 return chintsize(n + getintsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
486 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
487
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
488 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
489 FixedComplexRowVector::incintsize () {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5248
diff changeset
490 return chintsize(Complex (1) + getintsize());
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
491 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
492
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
493 // Fixed Point Complex Row Vector class.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
494
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
495 bool
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
496 FixedComplexRowVector::operator == (const FixedComplexRowVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
497 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
498 int len = length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
499 if (len != a.length ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
500 return 0;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
501
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
502 for (int i = 0; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
503 if (elem(i) != a.elem(i))
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
504 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
505 return true;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
506 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
507
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
508 bool
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
509 FixedComplexRowVector::operator != (const FixedComplexRowVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
510 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
511 return !(*this == a);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
512 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
513
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
514 FixedComplexRowVector&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
515 FixedComplexRowVector::insert (const FixedComplexRowVector& a, int c)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
516 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
517 int a_len = a.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
518
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
519 if (c < 0 || c + a_len > length ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
520 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
521 (*current_liboctave_error_handler) ("range error for insert");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
522 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
523 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
524
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
525 if (a_len > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
526 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
527 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
528
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
529 for (int i = 0; i < a_len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
530 xelem (c+i) = a.elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
531 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
532
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
533 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
534 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
535
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
536 FixedComplexRowVector&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
537 FixedComplexRowVector::fill (FixedPointComplex val)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
538 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
539 int len = length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
540
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
541 if (len > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
542 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
543 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
544
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
545 for (int i = 0; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
546 xelem (i) = val;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
547 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
548
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
549 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
550 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
551
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
552 FixedComplexRowVector&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
553 FixedComplexRowVector::fill (FixedPointComplex val, int c1, int c2)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
554 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
555 int len = length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
556
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
557 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
558 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
559 (*current_liboctave_error_handler) ("range error for fill");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
560 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
561 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
562
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
563 if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
564
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
565 if (c2 >= c1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
566 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
567 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
568
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
569 for (int i = c1; i <= c2; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
570 xelem (i) = val;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
571 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
572
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
573 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
574 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
575
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
576 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
577 FixedComplexRowVector::append (const FixedComplexRowVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
578 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
579 int len = length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
580 int nc_insert = len;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
581 FixedComplexRowVector retval (len + a.length ());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
582 retval.insert (*this, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
583 retval.insert (a, nc_insert);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
584 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
585 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
586
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
587 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
588 FixedComplexRowVector::transpose (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
589 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
590 return FixedComplexColumnVector (*this);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
591 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
592
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
593 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
594 FixedComplexRowVector::extract (int c1, int c2) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
595 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
596 if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
597
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
598 int new_c = c2 - c1 + 1;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
599
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
600 FixedComplexRowVector result (new_c);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
601
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
602 for (int i = 0; i < new_c; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
603 result.xelem (i) = elem (c1+i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
604
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
605 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
606 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
607
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
608 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
609 FixedComplexRowVector::extract_n (int r1, int n) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
610 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
611 FixedComplexRowVector result (n);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
612
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
613 for (int i = 0; i < n; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
614 result.xelem (i) = elem (r1+i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
615
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
616 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
617 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
618
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
619 // row vector by matrix -> row vector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
620
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
621 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
622 operator * (const FixedComplexRowVector& v, const FixedComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
623 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
624 FixedComplexRowVector retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
625
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
626 int len = v.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
627
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
628 int a_nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
629 int a_nc = a.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
630
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
631 if (a_nr != len)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
632 gripe_nonconformant ("operator *", 1, len, a_nr, a_nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
633 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
634 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
635 int a_nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
636 int a_nc = a.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
637
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
638 retval.resize (a_nc, FixedPointComplex());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
639 if (len != 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
640 for (int i = 0; i < a_nc; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
641 for (int j = 0; j < a_nr; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
642 retval.elem (i) += v.elem(j) * a.elem(j,i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
643 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
644
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
645 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
646 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
647
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
648 // other operations
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
649 FixedComplexRowVector
5248
f8d77845533f Changes for compilation with 3.1.51+
adb014
parents: 4404
diff changeset
650 FixedComplexRowVector::map (fpc_fpc_Mapper f) const
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
651 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
652 FixedComplexRowVector b (*this);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
653 return b.apply (f);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
654 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
655
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
656 FixedComplexRowVector&
5248
f8d77845533f Changes for compilation with 3.1.51+
adb014
parents: 4404
diff changeset
657 FixedComplexRowVector::apply (fpc_fpc_Mapper f)
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
658 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
659 FixedPointComplex *d = fortran_vec (); // Ensures only one reference to my privates!
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
660
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
661 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
662 d[i] = f (d[i]);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
663
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
664 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
665 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
666
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
667 FixedPointComplex
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
668 FixedComplexRowVector::min (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
669 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
670 int len = length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
671 if (len == 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
672 return FixedPointComplex();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
673
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
674 FixedPointComplex res = elem (0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
675 double res_val = std::abs(res.fixedpoint ());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
676
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
677 for (int i = 1; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
678 if (std::abs(elem (i) .fixedpoint ()) < res_val) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
679 res = elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
680 res_val = std::abs(res.fixedpoint ());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
681 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
682
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
683 return res;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
684 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
685
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
686 FixedPointComplex
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
687 FixedComplexRowVector::max (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
688 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
689 int len = length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
690 if (len == 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
691 return FixedPointComplex();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
692
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
693 FixedPointComplex res = elem (0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
694 double res_val = std::abs(res.fixedpoint ());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
695
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
696 for (int i = 1; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
697 if (std::abs(elem (i) .fixedpoint ()) > res_val) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
698 res = elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
699 res_val = std::abs(res.fixedpoint ());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
700 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
701
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
702 return res;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
703 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
704
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
705 #define DO_FIXED_VEC_FUNC(FUNC, MT) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
706 MT FUNC (const FixedComplexRowVector& x) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
707 { \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
708 MT retval (x.length()); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
709 for (int i = 0; i < x.length(); i++) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
710 retval(i) = FUNC ( x (i) ); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
711 return retval; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
712 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
713
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
714 DO_FIXED_VEC_FUNC(real, FixedRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
715 DO_FIXED_VEC_FUNC(imag, FixedRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
716 DO_FIXED_VEC_FUNC(conj, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
717 DO_FIXED_VEC_FUNC(abs, FixedRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
718 DO_FIXED_VEC_FUNC(norm, FixedRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
719 DO_FIXED_VEC_FUNC(arg, FixedRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
720 DO_FIXED_VEC_FUNC(cos, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
721 DO_FIXED_VEC_FUNC(cosh, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
722 DO_FIXED_VEC_FUNC(sin, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
723 DO_FIXED_VEC_FUNC(sinh, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
724 DO_FIXED_VEC_FUNC(tan, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
725 DO_FIXED_VEC_FUNC(tanh, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
726 DO_FIXED_VEC_FUNC(sqrt, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
727 DO_FIXED_VEC_FUNC(exp, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
728 DO_FIXED_VEC_FUNC(log, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
729 DO_FIXED_VEC_FUNC(log10, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
730 DO_FIXED_VEC_FUNC(round, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
731 DO_FIXED_VEC_FUNC(rint, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
732 DO_FIXED_VEC_FUNC(floor, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
733 DO_FIXED_VEC_FUNC(ceil, FixedComplexRowVector);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
734
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
735 FixedComplexRowVector polar (const FixedRowVector &r,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
736 const FixedRowVector &p)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
737 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
738 if (r.length() != p.length()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
739 (*current_liboctave_error_handler) ("vector size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
740 return FixedComplexRowVector();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
741 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
742
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
743 FixedComplexRowVector retval ( r.length());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
744 for (int i = 0; i < r.length(); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
745 retval(i) = polar ( r (i), p (i) );
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
746 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
747 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
748
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
749 FixedComplexRowVector elem_pow (const FixedComplexRowVector &a,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
750 const FixedComplexRowVector &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
751 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
752 FixedComplexRowVector retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
753 int a_len = a.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
754 int b_len = b.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
755
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
756 if (a_len == 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
757 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
758 retval.resize(b_len);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
759 FixedPointComplex ad = a(0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
760 for (int i = 0; i < b_len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
761 retval(i) = pow(ad, b(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
762 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
763 else if (b_len == 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
764 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
765 retval.resize(a_len);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
766 FixedPointComplex bd = b(0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
767 for (int i = 0; i < a_len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
768 retval(i) = pow(a(i), bd);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
769 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
770 else if (a_len == b_len)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
771 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
772 retval.resize(a_len);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
773 for (int i = 0; i < a_len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
774 retval(i) = pow(a(i), b(i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
775 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
776 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
777 gripe_nonconformant ("operator .^", a_len, b_len);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
778
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
779 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
780 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
781
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
782 FixedComplexRowVector elem_pow (const FixedComplexRowVector &a, const FixedPointComplex &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
783 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
784 return elem_pow (a, FixedComplexRowVector(1, b));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
785 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
786
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
787 FixedComplexRowVector elem_pow (const FixedPointComplex &a, const FixedComplexRowVector &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
788 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
789 return elem_pow (FixedComplexRowVector(1, a), b);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
790 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
791
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
792 std::ostream&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
793 operator << (std::ostream& os, const FixedComplexRowVector& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
794 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
795 for (int i = 0; i < a.length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
796 os << " " << a.elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
797 return os;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
798 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
799
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
800 std::istream&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
801 operator >> (std::istream& is, FixedComplexRowVector& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
802 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
803 int len = a.length();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
804
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
805 if (len < 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
806 is.clear (std::ios::badbit);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
807 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
808 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
809 FixedPointComplex tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
810 for (int i = 0; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
811 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
812 is >> tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
813 if (is)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
814 a.elem (i) = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
815 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
816 break;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
817 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
818 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
819 return is;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
820 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
821
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
822 // row vector by column vector -> scalar
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
823
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
824 FixedPointComplex
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
825 operator * (const FixedComplexRowVector& v, const FixedComplexColumnVector& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
826 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
827 FixedPointComplex retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
828
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
829 int len = v.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
830
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
831 int a_len = a.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
832
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
833 if (len != a_len)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
834 gripe_nonconformant ("operator *", len, a_len);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
835 else if (len != 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
836 for (int i = 0; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
837 retval += v.elem(i) * a.elem(i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
838
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
839 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
840 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
841
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
842 /*
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
843 ;;; Local Variables: ***
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
844 ;;; mode: C++ ***
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
845 ;;; End: ***
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
846 */