comparison liboctave/dRowVector.h @ 1205:8302fab9fe24

[project @ 1995-04-04 02:05:01 by jwe]
author jwe
date Tue, 04 Apr 1995 02:05:01 +0000
parents c01e881ccbb1
children 0bf4d2b7def4
comparison
equal deleted inserted replaced
1204:68d147abe7ca 1205:8302fab9fe24
31 extern "C++" { 31 extern "C++" {
32 32
33 class RowVector : public Array<double> 33 class RowVector : public Array<double>
34 { 34 {
35 friend class ColumnVector; 35 friend class ColumnVector;
36 friend class ComplexRowVector;
37 36
38 public: 37 public:
39 38
40 RowVector (void) : Array<double> () { } 39 RowVector (void) : Array<double> () { }
41 RowVector (int n) : Array<double> (n) { } 40 RowVector (int n) : Array<double> (n) { }
42 RowVector (int n, double val) : Array<double> (n, val) { } 41 RowVector (int n, double val) : Array<double> (n, val) { }
43 RowVector (const Array<double>& a) : Array<double> (a) { } 42 RowVector (const Array<double>& a) : Array<double> (a) { }
44 RowVector (const RowVector& a) : Array<double> (a) { } 43 RowVector (const RowVector& a) : Array<double> (a) { }
45 // RowVector (double a) : Array<double> (1, a) { }
46 44
47 RowVector& operator = (const RowVector& a) 45 RowVector& operator = (const RowVector& a)
48 { 46 {
49 Array<double>::operator = (a); 47 Array<double>::operator = (a);
50 return *this; 48 return *this;
51 } 49 }
52
53 // operator Array<double>& () const { return *this; }
54 50
55 int operator == (const RowVector& a) const; 51 int operator == (const RowVector& a) const;
56 int operator != (const RowVector& a) const; 52 int operator != (const RowVector& a) const;
57 53
58 // destructive insert/delete/reorder operations 54 // destructive insert/delete/reorder operations
64 60
65 RowVector append (const RowVector& a) const; 61 RowVector append (const RowVector& a) const;
66 62
67 ColumnVector transpose (void) const; 63 ColumnVector transpose (void) const;
68 64
65 friend RowVector real (const ComplexRowVector& a);
66 friend RowVector imag (const ComplexRowVector& a);
67
69 // resize is the destructive equivalent for this one 68 // resize is the destructive equivalent for this one
70 69
71 RowVector extract (int c1, int c2) const; 70 RowVector extract (int c1, int c2) const;
72 71
73 // row vector by row vector -> row vector operations 72 // row vector by row vector -> row vector operations
74 73
75 RowVector& operator += (const RowVector& a); 74 RowVector& operator += (const RowVector& a);
76 RowVector& operator -= (const RowVector& a); 75 RowVector& operator -= (const RowVector& a);
77 76
78 // row vector by scalar -> row vector operations
79
80 friend ComplexRowVector operator + (const RowVector& a, const Complex& s);
81 friend ComplexRowVector operator - (const RowVector& a, const Complex& s);
82 friend ComplexRowVector operator * (const RowVector& a, const Complex& s);
83 friend ComplexRowVector operator / (const RowVector& a, const Complex& s);
84
85 // scalar by row vector -> row vector operations
86
87 friend ComplexRowVector operator + (const Complex& s, const RowVector& a);
88 friend ComplexRowVector operator - (const Complex& s, const RowVector& a);
89 friend ComplexRowVector operator * (const Complex& s, const RowVector& a);
90 friend ComplexRowVector operator / (const Complex& s, const RowVector& a);
91
92 // row vector by column vector -> scalar
93
94 friend double operator * (const RowVector& a, const ColumnVector& b);
95
96 friend Complex operator * (const RowVector& a, const ComplexColumnVector& b);
97
98 // row vector by matrix -> row vector 77 // row vector by matrix -> row vector
99 78
100 friend RowVector operator * (const RowVector& a, const Matrix& b); 79 friend RowVector operator * (const RowVector& a, const Matrix& b);
101 80
102 friend ComplexRowVector operator * (const RowVector& a,
103 const ComplexMatrix& b);
104
105 // row vector by row vector -> row vector operations
106
107 friend ComplexRowVector operator + (const RowVector& a,
108 const ComplexRowVector& b);
109 friend ComplexRowVector operator - (const RowVector& a,
110 const ComplexRowVector& b);
111
112 friend ComplexRowVector product (const RowVector& a,
113 const ComplexRowVector& b);
114 friend ComplexRowVector quotient (const RowVector& a,
115 const ComplexRowVector& b);
116
117 // other operations 81 // other operations
118 82
119 friend RowVector map (d_d_Mapper f, const RowVector& a); 83 friend RowVector map (d_d_Mapper f, const RowVector& a);
84 friend RowVector map (d_c_Mapper f, const ComplexRowVector& a);
120 void map (d_d_Mapper f); 85 void map (d_d_Mapper f);
121 86
122 double min (void) const; 87 double min (void) const;
123 double max (void) const; 88 double max (void) const;
124 89
138 private: 103 private:
139 104
140 RowVector (double *d, int l) : Array<double> (d, l) { } 105 RowVector (double *d, int l) : Array<double> (d, l) { }
141 }; 106 };
142 107
108 // row vector by column vector -> scalar
109
110 double operator * (const RowVector& a, const ColumnVector& b);
111
112 Complex operator * (const RowVector& a, const ComplexColumnVector& b);
113
114 // other operations
115
143 RowVector linspace (double x1, double x2, int n); 116 RowVector linspace (double x1, double x2, int n);
144 117
145 } // extern "C++" 118 } // extern "C++"
146 119
147 #endif 120 #endif