MCPcopy Create free account
hub / github.com/boutproject/BOUT-dev / N_VLinearSum

Function N_VLinearSum

externalpackages/PVODE/source/nvector.cpp:185–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183
184
185void N_VLinearSum(real a, N_Vector x, real b, N_Vector y, N_Vector z)
186{
187 integer N;
188 real c, *xd, *yd, *zd;
189 N_Vector v, v1, v2;
190 boole test;
191
192 if ((b == ONE) && (z == y)) { /* BLAS usage: axpy y <- ax+y */
193 Vaxpy(a,x,y);
194 return;
195 }
196
197 if ((a == ONE) && (z == x)) { /* BLAS usage: axpy x <- by+x */
198 Vaxpy(b,y,x);
199 return;
200 }
201
202 /* Case: a == b == 1.0 */
203
204 if ((a == ONE) && (b == ONE)) {
205 VSum(x, y, z);
206 return;
207 }
208
209 /* Cases: (1) a == 1.0, b = -1.0, (2) a == -1.0, b == 1.0 */
210
211 if ((test = ((a == ONE) && (b == -ONE))) || ((a == -ONE) && (b == ONE))) {
212 v1 = test ? y : x;
213 v2 = test ? x : y;
214 VDiff(v2, v1, z);
215 return;
216 }
217
218 /* Cases: (1) a == 1.0, b == other or 0.0, (2) a == other or 0.0, b == 1.0 */
219 /* if a or b is 0.0, then user should have called N_VScale */
220
221 if ((test = (a == ONE)) || (b == ONE)) {
222 c = test ? b : a;
223 v1 = test ? y : x;
224 v2 = test ? x : y;
225 VLin1(c, v1, v2, z);
226 return;
227 }
228
229 /* Cases: (1) a == -1.0, b != 1.0, (2) a != 1.0, b == -1.0 */
230
231 if ((test = (a == -ONE)) || (b == -ONE)) {
232 c = test ? b : a;
233 v1 = test ? y : x;
234 v2 = test ? x : y;
235 VLin2(c, v1, v2, z);
236 return;
237 }
238
239 /* Case: a == b */
240 /* catches case both a and b are 0.0 - user should have called N_VConst */
241
242 if (a == b) {

Callers 15

SpgmrSolveFunction · 0.85
ModifiedGSFunction · 0.85
ClassicalGSFunction · 0.85
CVSpgmrAtimesDQFunction · 0.85
CVDiagSetupFunction · 0.85
CVodeDkyFunction · 0.85
CVEwtSetSVFunction · 0.85
CVUpperBoundH0Function · 0.85
CVYddNormFunction · 0.85
CVAdjustAdamsFunction · 0.85
CVIncreaseBDFFunction · 0.85
CVDecreaseBDFFunction · 0.85

Calls 7

VaxpyFunction · 0.85
VSumFunction · 0.85
VDiffFunction · 0.85
VLin1Function · 0.85
VLin2Function · 0.85
VScaleSumFunction · 0.85
VScaleDiffFunction · 0.85

Tested by

no test coverage detected