[shark] 12/58: fixed off-by one error in generation of rotation matrices. also the 1x1 rotation matrix is the identity
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Mar 16 10:05:27 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository shark.
commit cbe4ecb24fac0edf36b81140b5d401e152a2ab98
Author: Oswin <oswin.krause at di.ku.dk>
Date: Fri Jan 29 09:09:00 2016 +0100
fixed off-by one error in generation of rotation matrices. also the 1x1 rotation matrix is the identity
---
include/shark/LinAlg/rotations.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/shark/LinAlg/rotations.h b/include/shark/LinAlg/rotations.h
index aa0f539..658599c 100644
--- a/include/shark/LinAlg/rotations.h
+++ b/include/shark/LinAlg/rotations.h
@@ -172,12 +172,10 @@ void randomRotationMatrix(matrix_container<MatrixT>& matrixC,RngType& rng){
Normal< RngType > normal( rng, 0, 1 );
size_t size = matrix.size1();
diag(matrix) = repeat(1.0,size);
- //the first element is just -1 or 1
- matrix(size-1,size-1) = normal();
- matrix(size-1,size-1) /= std::abs(matrix(size-1,size-1));
-
+
RealVector v(size);
- for(std::size_t i = 2; i != size;++i){
+ //we skip the first dimension as the rotation of a 1d vector is just the identity
+ for(std::size_t i = 2; i != size+1;++i){
//create the random vector on the unit-sphere for the i-dimensional subproblem
for(std::size_t j=0;j != i; ++j){
v(j) = normal();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/shark.git
More information about the debian-science-commits
mailing list