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

Method Invert

SRC/matrix/Matrix.cpp:559–647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557
558
559int
560Matrix::Invert(Matrix &theInverse) const
561{
562
563 int n = numRows;
564
565
566#ifdef _G3DEBUG
567
568 if (numRows != numCols) {
569 opserr << "Matrix::Solve(B,X) - the matrix of dimensions [" << numRows << "," << numCols << "] is not square\n";
570 return -1;
571 }
572
573 if (n != theInverse.numRows) {
574 opserr << "Matrix::Solve(B,X) - #rows of X, " << numRows<< ", is not same as matrix " << theInverse.numRows << endln;
575 return -2;
576 }
577#endif
578
579 // check work area can hold all the data
580 if (dataSize > sizeDoubleWork) {
581
582 if (matrixWork != 0) {
583 delete [] matrixWork;
584 matrixWork = 0;
585 }
586 matrixWork = new (nothrow) double[dataSize];
587 sizeDoubleWork = dataSize;
588
589 if (matrixWork == 0) {
590 opserr << "WARNING: Matrix::Solve() - out of memory creating work area's\n";
591 sizeDoubleWork = 0;
592 return -3;
593 }
594 }
595
596 // check work area can hold all the data
597 if (n > sizeIntWork) {
598
599 if (intWork != 0) {
600 delete [] intWork;
601 intWork = 0;
602 }
603 intWork = new (nothrow) int[n];
604 sizeIntWork = n;
605
606 if (intWork == 0) {
607 opserr << "WARNING: Matrix::Solve() - out of memory creating work area's\n";
608 sizeIntWork = 0;
609 return -3;
610 }
611 }
612
613 // copy the data
614 theInverse = *this;
615
616 for (int i=0; i<dataSize; i++)

Callers 15

GetStabMethod · 0.45
GetStabMethod · 0.45
setDomainMethod · 0.45
GetStabMethod · 0.45
GetStabMethod · 0.45
GetPermeabilityMatrixMethod · 0.45
updateMethod · 0.45
getLMethod · 0.45
getFpMethod · 0.45
calculateAllMethod · 0.45
invert2by2MatrixFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected