MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / Solve

Method Solve

DEVELOPER/core/Matrix.cpp:363–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361#endif
362
363int
364Matrix::Solve(const Vector &b, Vector &x) const
365{
366
367 int n = numRows;
368
369#ifdef _G3DEBUG
370 if (numRows != numCols) {
371 opserr << "Matrix::Solve(b,x) - the matrix of dimensions "
372 << numRows << ", " << numCols << " is not square " << endln;
373 return -1;
374 }
375
376 if (n != x.Size()) {
377 opserr << "Matrix::Solve(b,x) - dimension of x, " << numRows << "is not same as matrix " << x.Size() << endln;
378 return -2;
379 }
380
381 if (n != b.Size()) {
382 opserr << "Matrix::Solve(b,x) - dimension of x, " << numRows << "is not same as matrix " << b.Size() << endln;
383 return -2;
384 }
385#endif
386
387 // check work area can hold all the data
388 if (dataSize > sizeDoubleWork) {
389
390 if (matrixWork != 0) {
391 delete [] matrixWork;
392 }
393 matrixWork = new (nothrow) double[dataSize];
394 sizeDoubleWork = dataSize;
395
396 if (matrixWork == 0) {
397 opserr << "WARNING: Matrix::Solve() - out of memory creating work area's\n";
398 sizeDoubleWork = 0;
399 return -3;
400 }
401 }
402
403 // check work area can hold all the data
404 if (n > sizeIntWork) {
405
406 if (intWork != 0) {
407 delete [] intWork;
408 }
409 intWork = new (nothrow) int[n];
410 sizeIntWork = n;
411
412 if (intWork == 0) {
413 opserr << "WARNING: Matrix::Solve() - out of memory creating work area's\n";
414 sizeIntWork = 0;
415 return -3;
416 }
417 }
418
419
420 // copy the data

Callers 7

setTrialStrainMethod · 0.45
setTrialStrainMethod · 0.45
setTrialStrainMethod · 0.45
operator/Method · 0.45

Calls 1

SizeMethod · 0.45

Tested by

no test coverage detected