Hi Julien,
The matrix multiplication code is ok. I've created a matrix unit
testing script (attached) that shows that the matrix multiplication
code is working. I've also loaded up your matrices into ipython and
have found that the problem is because the rows/columns have been
swapped between the old and new versions (or, rather, that the
definition of row and column is swapped when you create a matrix).
If you write
orient.inverse().transpose() * bead_force
you will get the same answer with the new code that you got with the
old code. This has come about because the old code had a "bug" that;
m = Matrix( 1, 2, 3, 4, 5, 6, 7, 8, 9 )
would load up the matrix by column and not by row (e.g. it should be
that the first row is 1,2,3, second row is 4,5,6 and third row is
7,8,9, however the old code set the first row to 1,4,7, second row to
2,5,8 and third row to 3,6,9). I had written the code assuming that
the matrix was loaded by row and not column, because I like to write
matrix code such as;
m = Matrix( 1, 2, 3 \
4, 5, 6 \
7, 8, 9 )
(which then makes sense if the matrix is loaded by row).
Fixing the "bug" that the matrix was being loaded by column rather
than row has caused one of your earlier matrices to be loaded up as a
transpose. I suspect that 'orient' is being loaded as the transpose.
To confuse things, the reason I didn't spot this bug was because the
"print()" function on matrix was also buggy and was printing out rows
as columns (so the transpose of the matrix was printed, rather than
the actual matrix). Fixing both the "loading by column" bug and
"printing the transpose" bug at the same time is why your orient
matrix looks the same in both the old and new codes, but why orient is
in fact different. You should go back to the code that defines orient
and make sure that it is being loaded by row.
Cheers,
Christopher
p.s. I have made quite a bit of progress upgrading Sire to python
3.4.2. In the process I have bundled in zlib and openssl, so that we
can ensure that pip/easy_install will always work. I am also working
on a script that can be used, post-install, to update the RPATH in all
libraries and executables so that post-installed python modules can be
fixed, packaged and then shipped.