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

Method addMatrixTransposeVector

SRC/matrix/Vector.cpp:459–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457
458
459int
460Vector::addMatrixTransposeVector(double thisFact,
461 const Matrix &m,
462 const Vector &v,
463 double otherFact )
464{
465 // see if quick return
466 if (otherFact == 0.0 && thisFact == 1.0)
467 return 0;
468
469#ifdef _G3DEBUG
470 // check the sizes are compatible
471 if ((sz != m.noRows()) && (m.noRows() != v.sz)) {
472 // otherwise incompatible sizes
473 opserr << "Vector::addMatrixTransposeVector() - incompatible sizes\n";
474 return -1;
475 }
476#endif
477
478 if (thisFact == 1.0) {
479
480 // want: this += m^t * v * otherFact
481 if (otherFact == 1.0) { // no point doing multiplication if otherFact = 1.0
482 int otherSize = v.sz;
483 double *matrixDataPtr = m.data;
484 double *otherDataPtrA = v.theData;
485 for (int i=0; i<sz; i++) {
486 double *otherDataPtr = otherDataPtrA;
487 double sum = 0.0;
488 for (int j=0; j<otherSize; j++)
489 sum += *matrixDataPtr++ * *otherDataPtr++;
490 theData[i] += sum;
491 }
492 } else if (otherFact == -1.0) { // no point doing multiplication if otherFact = 1.0
493 int otherSize = v.sz;
494 double *matrixDataPtr = m.data;
495 double *otherDataPtrA = v.theData;
496 for (int i=0; i<sz; i++) {
497 double *otherDataPtr = otherDataPtrA;
498 double sum = 0.0;
499 for (int j=0; j<otherSize; j++)
500 sum += *matrixDataPtr++ * *otherDataPtr++;
501 theData[i] -= sum;
502 }
503 } else {
504 int otherSize = v.sz;
505 double *matrixDataPtr = m.data;
506 double *otherDataPtrA = v.theData;
507 for (int i=0; i<sz; i++) {
508 double *otherDataPtr = otherDataPtrA;
509 double sum = 0.0;
510 for (int j=0; j<otherSize; j++)
511 sum += *matrixDataPtr++ * *otherDataPtr++;
512 theData[i] += sum * otherFact;
513 }
514 }
515 }
516

Callers 15

SSPquadUP.cppFile · 0.45
SSPbrick.cppFile · 0.45
SSPquad.cppFile · 0.45
updateMethod · 0.45
SSPbrickUP.cppFile · 0.45
getFpMethod · 0.45
updateMethod · 0.45
getFpMethod · 0.45
getdFpMethod · 0.45
calculateAllMethod · 0.45

Calls 1

noRowsMethod · 0.45

Tested by

no test coverage detected