Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with the transpose of SymMat #14

Closed
leo-bart opened this issue Jun 11, 2020 · 2 comments
Closed

Problem with the transpose of SymMat #14

leo-bart opened this issue Jun 11, 2020 · 2 comments

Comments

@leo-bart
Copy link

I'm using a symmatric matrix to perform a rotation of a 6x6 stiffness matrix like this:

SqrMat3 rotateY = BasicRotAIKy(phi);
SymMat randomRotationMatrix (6,EYE);
for (unsigned ri=0;ri<=2;ri++){
	for (unsigned rj=0;rj<=i;rj++){
		randomRotationMatrix(ri,rj) = rotateY(ri,rj);
		randomRotationMatrix(ri+3,rj+3) = rotateY(ri,rj);
		}
	}

SymMat rotatedStiffness(6,INIT,0.0);
rotatedStiffness = trans(randomRotationMatrix) * stiffnessMatrix * randomRotationMatrix;

This is a rather old code of mine: I've been using it this way for three years now, but when I compile against fmatvec commit 3c41097 I get the following error:

/usr/local/include/fmatvec/linear_algebra.h:1391:78: error: ‘const class fmatvec::Matrix<fmatvec::Symmetric, fmatvec::Ref, fmatvec::Ref, double>’ has no member named ‘T’
 1391 |   Matrix<Type,Col,Row,AT> trans(const Matrix<Type,Row,Col,AT> &A) { return A.T(); }
      |                                                                            ~~^

Is this a bug or the transpose of symmetric matrices is not currently supported?

@foerg
Copy link
Contributor

foerg commented Jun 11, 2020

As transpose has no effect on symmetric matrices it was removed to prevent the user of applying an unnecessary operation. Do you really need the transpose operator for SymMat?
I would recommend to omit trans in your operation or to use the function JTMJ:
rotatedStiffness = JTMJ(stiffnessMatrix, randomRotationMatrix);

@leo-bart
Copy link
Author

As matter of fact no, I don't need the transpose. I copied the code from another place (probably some old Matlab code) and did not put much thinking on it. Indeed now, looking at the code I realized it is wrong because I'm symmetrizing a non symmetric matrix. I'll correct it.

Thank you for informing the JTMJ function! I did not know it.

I'll close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants