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

Method addMatrix

SRC/matrix/Matrix.cpp:650–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648
649
650int
651Matrix::addMatrix(double factThis, const Matrix &other, double factOther)
652{
653 if (factThis == 1.0 && factOther == 0.0)
654 return 0;
655
656#ifdef _G3DEBUG
657 if ((other.numRows != numRows) || (other.numCols != numCols)) {
658 opserr << "Matrix::addMatrix(): incompatible matrices\n";
659 return -1;
660 }
661#endif
662
663 if (factThis == 1.0) {
664
665 // want: this += other * factOther
666 if (factOther == 1.0) {
667 double *dataPtr = data;
668 double *otherDataPtr = other.data;
669 for (int i=0; i<dataSize; i++)
670 *dataPtr++ += *otherDataPtr++;
671 } else {
672 double *dataPtr = data;
673 double *otherDataPtr = other.data;
674 for (int i=0; i<dataSize; i++)
675 *dataPtr++ += *otherDataPtr++ * factOther;
676 }
677 }
678
679 else if (factThis == 0.0) {
680
681 // want: this = other * factOther
682 if (factOther == 1.0) {
683 double *dataPtr = data;
684 double *otherDataPtr = other.data;
685 for (int i=0; i<dataSize; i++)
686 *dataPtr++ = *otherDataPtr++;
687 } else {
688 double *dataPtr = data;
689 double *otherDataPtr = other.data;
690 for (int i=0; i<dataSize; i++)
691 *dataPtr++ = *otherDataPtr++ * factOther;
692 }
693 }
694
695 else {
696
697 // want: this = this * thisFact + other * factOther
698 if (factOther == 1.0) {
699 double *dataPtr = data;
700 double *otherDataPtr = other.data;
701 for (int i=0; i<dataSize; i++) {
702 double value = *dataPtr * factThis + *otherDataPtr++;
703 *dataPtr++ = value;
704 }
705 } else {
706 double *dataPtr = data;
707 double *otherDataPtr = other.data;

Callers 15

Element.cppFile · 0.45
SSPquadUP.cppFile · 0.45
SSPbrickUP.cppFile · 0.45
computeBMatrixFunction · 0.45
invertBBendingTermsFunction · 0.45
computeBMatrixFunction · 0.45
invertBBendingTermsFunction · 0.45
Compute_HMethod · 0.45
Compute_LMethod · 0.45
integrateGaussMethod · 0.45
formDampingTermsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected