Changes in src/LinearAlgebra/Matrix.cpp [5b4605:80cecb5]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/LinearAlgebra/Matrix.cpp
r5b4605 r80cecb5 1 /* 2 * Project: MoleCuilder 3 * Description: creates and alters molecular systems 4 * Copyright (C) 2010 University of Bonn. All rights reserved. 5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. 6 */ 7 1 8 /* 2 9 * Matrix.cpp … … 5 12 * Author: crueger 6 13 */ 14 15 // include config.h 16 #ifdef HAVE_CONFIG_H 17 #include <config.h> 18 #endif 19 20 #include "Helpers/MemDebug.hpp" 7 21 8 22 #include "LinearAlgebra/Matrix.hpp" … … 108 122 } 109 123 124 void Matrix::rotation(const double x, const double y, const double z) 125 { 126 set(0,0, cos(y)*cos(z)); 127 set(0,1, cos(z)*sin(x)*sin(y) - cos(x)*sin(z)); 128 set(0,2, cos(x)*cos(z)*sin(y) + sin(x) * sin(z)); 129 set(1,0, cos(y)*sin(z)); 130 set(1,1, cos(x)*cos(z) + sin(x)*sin(y)*sin(z)); 131 set(1,2, -cos(z)*sin(x) + cos(x)*sin(y)*sin(z)); 132 set(2,0, -sin(y)); 133 set(2,1, cos(y)*sin(x)); 134 set(2,2, cos(x)*cos(y)); 135 } 136 110 137 Matrix &Matrix::operator=(const Matrix &src){ 111 138 if(&src!=this){ … … 213 240 214 241 215 voidMatrix::transpose()242 Matrix &Matrix::transpose() 216 243 { 217 244 double tmp; … … 219 246 for (int j=i+1;j<NDIM;j++) { 220 247 tmp = at(j,i); 248 at(j,i) = at(i,j); 221 249 at(i,j) = tmp; 222 at(j,i) = tmp;223 }250 } 251 return *this; 224 252 } 225 253 … … 253 281 gsl_eigen_symmv_free(T); 254 282 gsl_matrix_memcpy(content->content, evec); 283 gsl_matrix_free(evec); 255 284 Vector evalues(gsl_vector_get(eval,0), gsl_vector_get(eval,1), gsl_vector_get(eval,2)); 285 gsl_vector_free(eval); 256 286 return evalues; 257 287 } … … 315 345 316 346 Vector operator*(const Matrix &mat,const Vector &vec){ 317 gsl_vector *res = gsl_vector_calloc(NDIM); 318 gsl_blas_dgemv( CblasNoTrans, 1.0, mat.content->content, vec.content->content, 0.0, res); 319 VectorContent *content = new VectorContent(); 320 content->content = res; 321 return Vector(content); 347 Vector res; 348 gsl_blas_dgemv( CblasNoTrans, 1.0, mat.content->content, vec.content->content, 0.0, res.content->content); 349 return res; 322 350 } 323 351
Note:
See TracChangeset
for help on using the changeset viewer.