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

Method addMatrixTranspose

SRC/matrix/Matrix.cpp:720–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

718
719
720int
721Matrix::addMatrixTranspose(double factThis, const Matrix &other, double factOther)
722{
723 if (factThis == 1.0 && factOther == 0.0)
724 return 0;
725
726#ifdef _G3DEBUG
727 if ((other.numRows != numCols) || (other.numCols != numRows)) {
728 opserr << "Matrix::addMatrixTranspose(): incompatible matrices\n";
729 return -1;
730 }
731#endif
732
733 if (factThis == 1.0) {
734
735 // want: this += other^T * factOther
736 if (factOther == 1.0) {
737 double *dataPtr = data;
738 for (int j=0; j<numCols; j++) {
739 for (int i=0; i<numRows; i++)
740 *dataPtr++ += (other.data)[j+i*numCols];
741 }
742 } else {
743 double *dataPtr = data;
744 for (int j=0; j<numCols; j++) {
745 for (int i=0; i<numRows; i++)
746 *dataPtr++ += (other.data)[j+i*numCols] * factOther;
747 }
748 }
749 }
750
751 else if (factThis == 0.0) {
752
753 // want: this = other^T * factOther
754 if (factOther == 1.0) {
755 double *dataPtr = data;
756 for (int j=0; j<numCols; j++) {
757 for (int i=0; i<numRows; i++)
758 *dataPtr++ = (other.data)[j+i*numCols];
759 }
760 } else {
761 double *dataPtr = data;
762 for (int j=0; j<numCols; j++) {
763 for (int i=0; i<numRows; i++)
764 *dataPtr++ = (other.data)[j+i*numCols] * factOther;
765 }
766 }
767 }
768
769 else {
770
771 // want: this = this * thisFact + other^T * factOther
772 if (factOther == 1.0) {
773 double *dataPtr = data;
774 for (int j=0; j<numCols; j++) {
775 for (int i=0; i<numRows; i++) {
776 double value = *dataPtr * factThis + (other.data)[j+i*numCols];
777 *dataPtr++ = value;

Callers 11

calculateAllMethod · 0.45
calculateAllMethod · 0.45
transformToGlobalMethod · 0.45
transformToGlobalMethod · 0.45
revertToStartMethod · 0.45
updateMethod · 0.45
calculateStiffnessMethod · 0.45
calculateStiffnessMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected