|
@@ -101,6 +101,11 @@ tmpl VectorXD<X> &VectorXD<X>::mult(double k)
|
101
|
101
|
return *this;
|
102
|
102
|
}
|
103
|
103
|
|
|
104
|
+tmpl VectorXD<X> &VectorXD<X>::mult(double scalars[X])
|
|
105
|
+{
|
|
106
|
+ return mult(VectorXD<X>(scalars));
|
|
107
|
+}
|
|
108
|
+
|
104
|
109
|
tmpl VectorXD<X> &VectorXD<X>::mult(const VectorXD<X> &other)
|
105
|
110
|
{
|
106
|
111
|
for (unsigned i = 0; i < X; ++i) {
|
|
@@ -110,9 +115,23 @@ tmpl VectorXD<X> &VectorXD<X>::mult(const VectorXD<X> &other)
|
110
|
115
|
}
|
111
|
116
|
|
112
|
117
|
tmpl VectorXD<X> &VectorXD<X>::div(double k)
|
|
118
|
+{
|
|
119
|
+ double scalars[X];
|
|
120
|
+ for (unsigned i = 0; i < X; ++i) {
|
|
121
|
+ scalars[i] = k;
|
|
122
|
+ }
|
|
123
|
+ return div(VectorXD<X>(scalars));
|
|
124
|
+}
|
|
125
|
+
|
|
126
|
+tmpl VectorXD<X> &VectorXD<X>::div(double scalars[X])
|
|
127
|
+{
|
|
128
|
+ return div(VectorXD<X>(scalars));
|
|
129
|
+}
|
|
130
|
+
|
|
131
|
+tmpl VectorXD<X> &VectorXD<X>::div(const VectorXD<X> &other)
|
113
|
132
|
{
|
114
|
133
|
for (unsigned i = 0; i < X; ++i) {
|
115
|
|
- _scalars[i] /= k;
|
|
134
|
+ _scalars[i] /= other._scalars[i];
|
116
|
135
|
}
|
117
|
136
|
return *this;
|
118
|
137
|
}
|