void PenaltyMP_FE::determineTangent(void) { // first determine [C] = [-I [Ccr]] C->Zero(); const Matrix &constraint = theMP->getConstraint(); int noRows = constraint.noRows(); int noCols = constraint.noCols(); for (int j=0; j<noRows; j++) (*C)(j,j) = -1.0; for (int i=0; i<noRows; i++) for (int j=0; j<noCols; j++) (*C)(i,j+noRows) = constraint(i,j); // now form the tangent: [K] = alpha * [C]^t[C] // *(tang) = (*C)^(*C); // *(tang) *= alpha; // THIS IS A WORKAROUND UNTIL WE GET addMatrixTransposeProduct() IN // THE Matrix CLASS OR UNROLL THIS COMPUTATION int rows = C->noRows(); int cols = C->noCols(); Matrix CT(cols,rows); const Matrix &Cref = *C; // Fill in the transpose of C for (int k = 0; k < cols; k++) for (int l = 0; l < rows; l++) CT(k,l) = Cref(l,k); // Compute alpha*(C^*C) tang->addMatrixProduct(0.0, CT, Cref, alpha); }
//[]运算符重载,非const String::Cref String::operator[](int i) { check(i); return Cref(*this,i); }