| [bcf653] | 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 | 
 | 
|---|
| [5630bd] | 8 | /*
 | 
|---|
 | 9 |  * MatrixUnittest.cpp
 | 
|---|
 | 10 |  *
 | 
|---|
 | 11 |  *  Created on: Jul 7, 2010
 | 
|---|
 | 12 |  *      Author: crueger
 | 
|---|
 | 13 |  */
 | 
|---|
 | 14 | 
 | 
|---|
| [bf3817] | 15 | // include config.h
 | 
|---|
 | 16 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 17 | #include <config.h>
 | 
|---|
 | 18 | #endif
 | 
|---|
 | 19 | 
 | 
|---|
| [5630bd] | 20 | #include <cppunit/CompilerOutputter.h>
 | 
|---|
 | 21 | #include <cppunit/extensions/TestFactoryRegistry.h>
 | 
|---|
 | 22 | #include <cppunit/ui/text/TestRunner.h>
 | 
|---|
 | 23 | 
 | 
|---|
| [31fb1d] | 24 | #include <cmath>
 | 
|---|
 | 25 | 
 | 
|---|
| [5630bd] | 26 | #include "MatrixUnittest.hpp"
 | 
|---|
| [57f243] | 27 | #include "LinearAlgebra/Vector.hpp"
 | 
|---|
| [6c438f] | 28 | #include "LinearAlgebra/Matrix.hpp"
 | 
|---|
| [5630bd] | 29 | #include "Exceptions/NotInvertibleException.hpp"
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | #ifdef HAVE_TESTRUNNER
 | 
|---|
 | 32 | #include "UnitTestMain.hpp"
 | 
|---|
 | 33 | #endif /*HAVE_TESTRUNNER*/
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | // Registers the fixture into the 'registry'
 | 
|---|
 | 36 | CPPUNIT_TEST_SUITE_REGISTRATION( MatrixUnittest );
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | void MatrixUnittest::setUp(){
 | 
|---|
 | 39 |   zero = new Matrix();
 | 
|---|
 | 40 |   one = new Matrix();
 | 
|---|
 | 41 |   for(int i =NDIM;i--;){
 | 
|---|
 | 42 |     one->at(i,i)=1.;
 | 
|---|
 | 43 |   }
 | 
|---|
 | 44 |   full=new Matrix();
 | 
|---|
 | 45 |   for(int i=NDIM;i--;){
 | 
|---|
 | 46 |     for(int j=NDIM;j--;){
 | 
|---|
 | 47 |       full->at(i,j)=1.;
 | 
|---|
 | 48 |     }
 | 
|---|
 | 49 |   }
 | 
|---|
 | 50 |   diagonal = new Matrix();
 | 
|---|
 | 51 |   for(int i=NDIM;i--;){
 | 
|---|
 | 52 |     diagonal->at(i,i)=i+1.;
 | 
|---|
 | 53 |   }
 | 
|---|
 | 54 |   perm1 = new Matrix();
 | 
|---|
| [407782] | 55 |   perm1->column(0) = unitVec[0];
 | 
|---|
 | 56 |   perm1->column(1) = unitVec[2];
 | 
|---|
 | 57 |   perm1->column(2) = unitVec[1];
 | 
|---|
| [5630bd] | 58 | 
 | 
|---|
 | 59 | 
 | 
|---|
 | 60 |   perm2 = new Matrix();
 | 
|---|
| [407782] | 61 |   perm2->column(0) = unitVec[1];
 | 
|---|
 | 62 |   perm2->column(1) = unitVec[0];
 | 
|---|
 | 63 |   perm2->column(2) = unitVec[2];
 | 
|---|
| [5630bd] | 64 | 
 | 
|---|
 | 65 |   perm3 = new Matrix();
 | 
|---|
| [407782] | 66 |   perm3->column(0) = unitVec[1];
 | 
|---|
 | 67 |   perm3->column(1) = unitVec[2];
 | 
|---|
 | 68 |   perm3->column(2) = unitVec[0];
 | 
|---|
| [5630bd] | 69 | 
 | 
|---|
 | 70 |   perm4 = new Matrix();
 | 
|---|
| [407782] | 71 |   perm4->column(0) = unitVec[2];
 | 
|---|
 | 72 |   perm4->column(1) = unitVec[1];
 | 
|---|
 | 73 |   perm4->column(2) = unitVec[0];
 | 
|---|
| [5630bd] | 74 | 
 | 
|---|
 | 75 |   perm5 = new Matrix();
 | 
|---|
| [407782] | 76 |   perm5->column(0) = unitVec[2];
 | 
|---|
 | 77 |   perm5->column(1) = unitVec[0];
 | 
|---|
 | 78 |   perm5->column(2) = unitVec[1];
 | 
|---|
| [5630bd] | 79 | 
 | 
|---|
 | 80 | }
 | 
|---|
 | 81 | void MatrixUnittest::tearDown(){
 | 
|---|
 | 82 |   delete zero;
 | 
|---|
 | 83 |   delete one;
 | 
|---|
 | 84 |   delete full;
 | 
|---|
 | 85 |   delete diagonal;
 | 
|---|
 | 86 |   delete perm1;
 | 
|---|
 | 87 |   delete perm2;
 | 
|---|
 | 88 |   delete perm3;
 | 
|---|
 | 89 |   delete perm4;
 | 
|---|
 | 90 |   delete perm5;
 | 
|---|
 | 91 | }
 | 
|---|
 | 92 | 
 | 
|---|
 | 93 | void MatrixUnittest::AccessTest(){
 | 
|---|
 | 94 |   Matrix mat;
 | 
|---|
 | 95 |   for(int i=NDIM;i--;){
 | 
|---|
 | 96 |     for(int j=NDIM;j--;){
 | 
|---|
 | 97 |       CPPUNIT_ASSERT_EQUAL(mat.at(i,j),0.);
 | 
|---|
 | 98 |     }
 | 
|---|
 | 99 |   }
 | 
|---|
 | 100 |   int k=1;
 | 
|---|
 | 101 |   for(int i=NDIM;i--;){
 | 
|---|
 | 102 |     for(int j=NDIM;j--;){
 | 
|---|
 | 103 |       mat.at(i,j)=k++;
 | 
|---|
 | 104 |     }
 | 
|---|
 | 105 |   }
 | 
|---|
 | 106 |   k=1;
 | 
|---|
 | 107 |   for(int i=NDIM;i--;){
 | 
|---|
 | 108 |     for(int j=NDIM;j--;){
 | 
|---|
 | 109 |       CPPUNIT_ASSERT_EQUAL(mat.at(i,j),(double)k);
 | 
|---|
 | 110 |       ++k;
 | 
|---|
 | 111 |     }
 | 
|---|
 | 112 |   }
 | 
|---|
 | 113 | }
 | 
|---|
 | 114 | 
 | 
|---|
 | 115 | void MatrixUnittest::VectorTest(){
 | 
|---|
 | 116 |   Matrix mat;
 | 
|---|
 | 117 |   for(int i=NDIM;i--;){
 | 
|---|
 | 118 |     CPPUNIT_ASSERT_EQUAL(mat.row(i),zeroVec);
 | 
|---|
 | 119 |     CPPUNIT_ASSERT_EQUAL(mat.column(i),zeroVec);
 | 
|---|
 | 120 |   }
 | 
|---|
 | 121 |   CPPUNIT_ASSERT_EQUAL(mat.diagonal(),zeroVec);
 | 
|---|
 | 122 | 
 | 
|---|
 | 123 |   mat.one();
 | 
|---|
| [407782] | 124 |   CPPUNIT_ASSERT_EQUAL(mat.row(0),unitVec[0]);
 | 
|---|
 | 125 |   CPPUNIT_ASSERT_EQUAL(mat.row(1),unitVec[1]);
 | 
|---|
 | 126 |   CPPUNIT_ASSERT_EQUAL(mat.row(2),unitVec[2]);
 | 
|---|
 | 127 |   CPPUNIT_ASSERT_EQUAL(mat.column(0),unitVec[0]);
 | 
|---|
 | 128 |   CPPUNIT_ASSERT_EQUAL(mat.column(1),unitVec[1]);
 | 
|---|
 | 129 |   CPPUNIT_ASSERT_EQUAL(mat.column(2),unitVec[2]);
 | 
|---|
| [5630bd] | 130 | 
 | 
|---|
 | 131 |   Vector t1=Vector(1.,1.,1.);
 | 
|---|
 | 132 |   Vector t2=Vector(2.,2.,2.);
 | 
|---|
 | 133 |   Vector t3=Vector(3.,3.,3.);
 | 
|---|
 | 134 |   Vector t4=Vector(1.,2.,3.);
 | 
|---|
 | 135 | 
 | 
|---|
 | 136 |   mat.row(0)=t1;
 | 
|---|
 | 137 |   mat.row(1)=t2;
 | 
|---|
 | 138 |   mat.row(2)=t3;
 | 
|---|
 | 139 |   CPPUNIT_ASSERT_EQUAL(mat.row(0),t1);
 | 
|---|
 | 140 |   CPPUNIT_ASSERT_EQUAL(mat.row(1),t2);
 | 
|---|
 | 141 |   CPPUNIT_ASSERT_EQUAL(mat.row(2),t3);
 | 
|---|
 | 142 |   CPPUNIT_ASSERT_EQUAL(mat.column(0),t4);
 | 
|---|
 | 143 |   CPPUNIT_ASSERT_EQUAL(mat.column(1),t4);
 | 
|---|
 | 144 |   CPPUNIT_ASSERT_EQUAL(mat.column(2),t4);
 | 
|---|
 | 145 |   CPPUNIT_ASSERT_EQUAL(mat.diagonal(),t4);
 | 
|---|
 | 146 |   for(int i=NDIM;i--;){
 | 
|---|
 | 147 |     for(int j=NDIM;j--;){
 | 
|---|
 | 148 |       CPPUNIT_ASSERT_EQUAL(mat.at(i,j),i+1.);
 | 
|---|
 | 149 |     }
 | 
|---|
 | 150 |   }
 | 
|---|
 | 151 | 
 | 
|---|
 | 152 |   mat.column(0)=t1;
 | 
|---|
 | 153 |   mat.column(1)=t2;
 | 
|---|
 | 154 |   mat.column(2)=t3;
 | 
|---|
 | 155 |   CPPUNIT_ASSERT_EQUAL(mat.column(0),t1);
 | 
|---|
 | 156 |   CPPUNIT_ASSERT_EQUAL(mat.column(1),t2);
 | 
|---|
 | 157 |   CPPUNIT_ASSERT_EQUAL(mat.column(2),t3);
 | 
|---|
 | 158 |   CPPUNIT_ASSERT_EQUAL(mat.row(0),t4);
 | 
|---|
 | 159 |   CPPUNIT_ASSERT_EQUAL(mat.row(1),t4);
 | 
|---|
 | 160 |   CPPUNIT_ASSERT_EQUAL(mat.row(2),t4);
 | 
|---|
 | 161 |   CPPUNIT_ASSERT_EQUAL(mat.diagonal(),t4);
 | 
|---|
 | 162 |   for(int i=NDIM;i--;){
 | 
|---|
 | 163 |     for(int j=NDIM;j--;){
 | 
|---|
 | 164 |       CPPUNIT_ASSERT_EQUAL(mat.at(i,j),j+1.);
 | 
|---|
 | 165 |     }
 | 
|---|
 | 166 |   }
 | 
|---|
 | 167 | }
 | 
|---|
 | 168 | 
 | 
|---|
| [31fb1d] | 169 | void MatrixUnittest::TransposeTest(){
 | 
|---|
 | 170 |   Matrix res;
 | 
|---|
 | 171 | 
 | 
|---|
 | 172 |   // transpose of unit is unit
 | 
|---|
 | 173 |   res.one();
 | 
|---|
 | 174 |   (const Matrix)res.transpose();
 | 
|---|
 | 175 |   CPPUNIT_ASSERT_EQUAL(res,*one);
 | 
|---|
 | 176 | 
 | 
|---|
 | 177 |   // transpose of transpose is same matrix
 | 
|---|
 | 178 |   res.zero();
 | 
|---|
 | 179 |   res.set(2,2, 1.);
 | 
|---|
 | 180 |   CPPUNIT_ASSERT_EQUAL(res.transpose().transpose(),res);
 | 
|---|
 | 181 | }
 | 
|---|
 | 182 | 
 | 
|---|
| [5630bd] | 183 | void MatrixUnittest::OperationTest(){
 | 
|---|
 | 184 |   Matrix res;
 | 
|---|
 | 185 | 
 | 
|---|
 | 186 |   res =(*zero) *(*zero);
 | 
|---|
 | 187 |   CPPUNIT_ASSERT_EQUAL(res,*zero);
 | 
|---|
 | 188 |   res =(*zero) *(*one);
 | 
|---|
 | 189 |   CPPUNIT_ASSERT_EQUAL(res,*zero);
 | 
|---|
 | 190 |   res =(*zero) *(*full);
 | 
|---|
 | 191 |   CPPUNIT_ASSERT_EQUAL(res,*zero);
 | 
|---|
 | 192 |   res =(*zero) *(*diagonal);
 | 
|---|
 | 193 |   CPPUNIT_ASSERT_EQUAL(res,*zero);
 | 
|---|
 | 194 |   res =(*zero) *(*perm1);
 | 
|---|
 | 195 |   CPPUNIT_ASSERT_EQUAL(res,*zero);
 | 
|---|
 | 196 |   res =(*zero) *(*perm2);
 | 
|---|
 | 197 |   CPPUNIT_ASSERT_EQUAL(res,*zero);
 | 
|---|
 | 198 |   res =(*zero) *(*perm3);
 | 
|---|
 | 199 |   CPPUNIT_ASSERT_EQUAL(res,*zero);
 | 
|---|
 | 200 |   res =(*zero) *(*perm4);
 | 
|---|
 | 201 |   CPPUNIT_ASSERT_EQUAL(res,*zero);
 | 
|---|
 | 202 |   res =(*zero) *(*perm5);
 | 
|---|
 | 203 |   CPPUNIT_ASSERT_EQUAL(res,*zero);
 | 
|---|
 | 204 | 
 | 
|---|
 | 205 |   res =(*one)*(*one);
 | 
|---|
 | 206 |   CPPUNIT_ASSERT_EQUAL(res,*one);
 | 
|---|
 | 207 |   res =(*one)*(*full);
 | 
|---|
 | 208 |   CPPUNIT_ASSERT_EQUAL(res,*full);
 | 
|---|
 | 209 |   res =(*one)*(*diagonal);
 | 
|---|
 | 210 |   CPPUNIT_ASSERT_EQUAL(res,*diagonal);
 | 
|---|
 | 211 |   res =(*one)*(*perm1);
 | 
|---|
 | 212 |   CPPUNIT_ASSERT_EQUAL(res,*perm1);
 | 
|---|
 | 213 |   res =(*one)*(*perm2);
 | 
|---|
 | 214 |   CPPUNIT_ASSERT_EQUAL(res,*perm2);
 | 
|---|
 | 215 |   res =(*one)*(*perm3);
 | 
|---|
 | 216 |   CPPUNIT_ASSERT_EQUAL(res,*perm3);
 | 
|---|
 | 217 |   res =(*one)*(*perm4);
 | 
|---|
 | 218 |   CPPUNIT_ASSERT_EQUAL(res,*perm4);
 | 
|---|
 | 219 |   res =(*one)*(*perm5);
 | 
|---|
 | 220 |   CPPUNIT_ASSERT_EQUAL(res,*perm5);
 | 
|---|
 | 221 | 
 | 
|---|
 | 222 |   res = (*full)*(*perm1);
 | 
|---|
 | 223 |   CPPUNIT_ASSERT_EQUAL(res,*full);
 | 
|---|
 | 224 |   res = (*full)*(*perm2);
 | 
|---|
 | 225 |   CPPUNIT_ASSERT_EQUAL(res,*full);
 | 
|---|
 | 226 |   res = (*full)*(*perm3);
 | 
|---|
 | 227 |   CPPUNIT_ASSERT_EQUAL(res,*full);
 | 
|---|
 | 228 |   res = (*full)*(*perm4);
 | 
|---|
 | 229 |   CPPUNIT_ASSERT_EQUAL(res,*full);
 | 
|---|
 | 230 |   res = (*full)*(*perm5);
 | 
|---|
 | 231 |   CPPUNIT_ASSERT_EQUAL(res,*full);
 | 
|---|
 | 232 | 
 | 
|---|
 | 233 |   res = (*diagonal)*(*perm1);
 | 
|---|
| [407782] | 234 |   CPPUNIT_ASSERT_EQUAL(res.column(0),unitVec[0]);
 | 
|---|
 | 235 |   CPPUNIT_ASSERT_EQUAL(res.column(1),3*unitVec[2]);
 | 
|---|
 | 236 |   CPPUNIT_ASSERT_EQUAL(res.column(2),2*unitVec[1]);
 | 
|---|
| [5630bd] | 237 |   res = (*diagonal)*(*perm2);
 | 
|---|
| [407782] | 238 |   CPPUNIT_ASSERT_EQUAL(res.column(0),2*unitVec[1]);
 | 
|---|
 | 239 |   CPPUNIT_ASSERT_EQUAL(res.column(1),unitVec[0]);
 | 
|---|
 | 240 |   CPPUNIT_ASSERT_EQUAL(res.column(2),3*unitVec[2]);
 | 
|---|
| [5630bd] | 241 |   res = (*diagonal)*(*perm3);
 | 
|---|
| [407782] | 242 |   CPPUNIT_ASSERT_EQUAL(res.column(0),2*unitVec[1]);
 | 
|---|
 | 243 |   CPPUNIT_ASSERT_EQUAL(res.column(1),3*unitVec[2]);
 | 
|---|
 | 244 |   CPPUNIT_ASSERT_EQUAL(res.column(2),unitVec[0]);
 | 
|---|
| [5630bd] | 245 |   res = (*diagonal)*(*perm4);
 | 
|---|
| [407782] | 246 |   CPPUNIT_ASSERT_EQUAL(res.column(0),3*unitVec[2]);
 | 
|---|
 | 247 |   CPPUNIT_ASSERT_EQUAL(res.column(1),2*unitVec[1]);
 | 
|---|
 | 248 |   CPPUNIT_ASSERT_EQUAL(res.column(2),unitVec[0]);
 | 
|---|
| [5630bd] | 249 |   res = (*diagonal)*(*perm5);
 | 
|---|
| [407782] | 250 |   CPPUNIT_ASSERT_EQUAL(res.column(0),3*unitVec[2]);
 | 
|---|
 | 251 |   CPPUNIT_ASSERT_EQUAL(res.column(1),unitVec[0]);
 | 
|---|
 | 252 |   CPPUNIT_ASSERT_EQUAL(res.column(2),2*unitVec[1]);
 | 
|---|
| [5630bd] | 253 | }
 | 
|---|
 | 254 | 
 | 
|---|
| [31fb1d] | 255 | void MatrixUnittest::RotationTest(){
 | 
|---|
 | 256 |   Matrix res;
 | 
|---|
 | 257 |   Matrix inverse;
 | 
|---|
 | 258 | 
 | 
|---|
 | 259 |   // zero rotation angles yields unity matrix
 | 
|---|
 | 260 |   res.rotation(0,0,0);
 | 
|---|
 | 261 |   CPPUNIT_ASSERT_EQUAL(*one, res);
 | 
|---|
 | 262 | 
 | 
|---|
 | 263 |   // arbitrary rotation matrix has det = 1
 | 
|---|
 | 264 |   res.rotation(M_PI/3.,1.,M_PI/7.);
 | 
|---|
 | 265 |   CPPUNIT_ASSERT(fabs(fabs(res.determinant()) -1.) < MYEPSILON);
 | 
|---|
 | 266 | 
 | 
|---|
 | 267 |   // inverse is rotation matrix with negative angles
 | 
|---|
 | 268 |   res.rotation(M_PI/3.,0.,0.);
 | 
|---|
 | 269 |   inverse.rotation(-M_PI/3.,0.,0.);
 | 
|---|
 | 270 |   CPPUNIT_ASSERT_EQUAL(*one, res * inverse);
 | 
|---|
 | 271 | 
 | 
|---|
 | 272 |   // ... or transposed
 | 
|---|
 | 273 |   res.rotation(M_PI/3.,0.,0.);
 | 
|---|
 | 274 |   CPPUNIT_ASSERT_EQUAL(inverse, ((const Matrix) res).transpose());
 | 
|---|
 | 275 | }
 | 
|---|
| [5630bd] | 276 | 
 | 
|---|
 | 277 | void MatrixUnittest::InvertTest(){
 | 
|---|
 | 278 |   CPPUNIT_ASSERT_THROW(zero->invert(),NotInvertibleException);
 | 
|---|
 | 279 |   CPPUNIT_ASSERT_THROW(full->invert(),NotInvertibleException);
 | 
|---|
 | 280 | 
 | 
|---|
 | 281 |   Matrix res;
 | 
|---|
 | 282 |   res = (*one)*one->invert();
 | 
|---|
 | 283 |   CPPUNIT_ASSERT_EQUAL(res,*one);
 | 
|---|
 | 284 |   res = (*diagonal)*diagonal->invert();
 | 
|---|
 | 285 |   CPPUNIT_ASSERT_EQUAL(res,*one);
 | 
|---|
 | 286 |   res = (*perm1)*perm1->invert();
 | 
|---|
 | 287 |   CPPUNIT_ASSERT_EQUAL(res,*one);
 | 
|---|
 | 288 |   res = (*perm2)*perm2->invert();
 | 
|---|
 | 289 |   CPPUNIT_ASSERT_EQUAL(res,*one);
 | 
|---|
 | 290 |   res = (*perm3)*perm3->invert();
 | 
|---|
 | 291 |   CPPUNIT_ASSERT_EQUAL(res,*one);
 | 
|---|
 | 292 |   res = (*perm4)*perm4->invert();
 | 
|---|
 | 293 |   CPPUNIT_ASSERT_EQUAL(res,*one);
 | 
|---|
 | 294 |   res = (*perm5)*perm5->invert();
 | 
|---|
 | 295 |   CPPUNIT_ASSERT_EQUAL(res,*one);
 | 
|---|
 | 296 | }
 | 
|---|
 | 297 | 
 | 
|---|
 | 298 | 
 | 
|---|
 | 299 | void MatrixUnittest::DeterminantTest(){
 | 
|---|
 | 300 |   CPPUNIT_ASSERT_EQUAL(zero->determinant(),0.);
 | 
|---|
 | 301 |   CPPUNIT_ASSERT_EQUAL(one->determinant(),1.);
 | 
|---|
 | 302 |   CPPUNIT_ASSERT_EQUAL(diagonal->determinant(),6.);
 | 
|---|
 | 303 |   CPPUNIT_ASSERT_EQUAL(full->determinant(),0.);
 | 
|---|
 | 304 |   CPPUNIT_ASSERT_EQUAL(perm1->determinant(),-1.);
 | 
|---|
 | 305 |   CPPUNIT_ASSERT_EQUAL(perm2->determinant(),-1.);
 | 
|---|
 | 306 |   CPPUNIT_ASSERT_EQUAL(perm3->determinant(),1.);
 | 
|---|
 | 307 |   CPPUNIT_ASSERT_EQUAL(perm4->determinant(),-1.);
 | 
|---|
 | 308 |   CPPUNIT_ASSERT_EQUAL(perm5->determinant(),1.);
 | 
|---|
 | 309 | }
 | 
|---|
 | 310 | 
 | 
|---|
 | 311 | void MatrixUnittest::VecMultTest(){
 | 
|---|
| [407782] | 312 |   CPPUNIT_ASSERT_EQUAL((*zero)*unitVec[0],zeroVec);
 | 
|---|
 | 313 |   CPPUNIT_ASSERT_EQUAL((*zero)*unitVec[1],zeroVec);
 | 
|---|
 | 314 |   CPPUNIT_ASSERT_EQUAL((*zero)*unitVec[2],zeroVec);
 | 
|---|
| [5630bd] | 315 |   CPPUNIT_ASSERT_EQUAL((*zero)*zeroVec,zeroVec);
 | 
|---|
 | 316 | 
 | 
|---|
| [407782] | 317 |   CPPUNIT_ASSERT_EQUAL((*one)*unitVec[0],unitVec[0]);
 | 
|---|
 | 318 |   CPPUNIT_ASSERT_EQUAL((*one)*unitVec[1],unitVec[1]);
 | 
|---|
 | 319 |   CPPUNIT_ASSERT_EQUAL((*one)*unitVec[2],unitVec[2]);
 | 
|---|
| [5630bd] | 320 |   CPPUNIT_ASSERT_EQUAL((*one)*zeroVec,zeroVec);
 | 
|---|
 | 321 | 
 | 
|---|
| [407782] | 322 |   CPPUNIT_ASSERT_EQUAL((*diagonal)*unitVec[0],unitVec[0]);
 | 
|---|
 | 323 |   CPPUNIT_ASSERT_EQUAL((*diagonal)*unitVec[1],2*unitVec[1]);
 | 
|---|
 | 324 |   CPPUNIT_ASSERT_EQUAL((*diagonal)*unitVec[2],3*unitVec[2]);
 | 
|---|
| [5630bd] | 325 |   CPPUNIT_ASSERT_EQUAL((*diagonal)*zeroVec,zeroVec);
 | 
|---|
 | 326 | 
 | 
|---|
| [407782] | 327 |   CPPUNIT_ASSERT_EQUAL((*perm1)*unitVec[0],unitVec[0]);
 | 
|---|
 | 328 |   CPPUNIT_ASSERT_EQUAL((*perm1)*unitVec[1],unitVec[2]);
 | 
|---|
 | 329 |   CPPUNIT_ASSERT_EQUAL((*perm1)*unitVec[2],unitVec[1]);
 | 
|---|
| [5630bd] | 330 |   CPPUNIT_ASSERT_EQUAL((*perm1)*zeroVec,zeroVec);
 | 
|---|
 | 331 | 
 | 
|---|
| [407782] | 332 |   CPPUNIT_ASSERT_EQUAL((*perm2)*unitVec[0],unitVec[1]);
 | 
|---|
 | 333 |   CPPUNIT_ASSERT_EQUAL((*perm2)*unitVec[1],unitVec[0]);
 | 
|---|
 | 334 |   CPPUNIT_ASSERT_EQUAL((*perm2)*unitVec[2],unitVec[2]);
 | 
|---|
| [5630bd] | 335 |   CPPUNIT_ASSERT_EQUAL((*perm2)*zeroVec,zeroVec);
 | 
|---|
 | 336 | 
 | 
|---|
| [407782] | 337 |   CPPUNIT_ASSERT_EQUAL((*perm3)*unitVec[0],unitVec[1]);
 | 
|---|
 | 338 |   CPPUNIT_ASSERT_EQUAL((*perm3)*unitVec[1],unitVec[2]);
 | 
|---|
 | 339 |   CPPUNIT_ASSERT_EQUAL((*perm3)*unitVec[2],unitVec[0]);
 | 
|---|
| [5630bd] | 340 |   CPPUNIT_ASSERT_EQUAL((*perm3)*zeroVec,zeroVec);
 | 
|---|
 | 341 | 
 | 
|---|
| [407782] | 342 |   CPPUNIT_ASSERT_EQUAL((*perm4)*unitVec[0],unitVec[2]);
 | 
|---|
 | 343 |   CPPUNIT_ASSERT_EQUAL((*perm4)*unitVec[1],unitVec[1]);
 | 
|---|
 | 344 |   CPPUNIT_ASSERT_EQUAL((*perm4)*unitVec[2],unitVec[0]);
 | 
|---|
| [5630bd] | 345 |   CPPUNIT_ASSERT_EQUAL((*perm4)*zeroVec,zeroVec);
 | 
|---|
 | 346 | 
 | 
|---|
| [407782] | 347 |   CPPUNIT_ASSERT_EQUAL((*perm5)*unitVec[0],unitVec[2]);
 | 
|---|
 | 348 |   CPPUNIT_ASSERT_EQUAL((*perm5)*unitVec[1],unitVec[0]);
 | 
|---|
 | 349 |   CPPUNIT_ASSERT_EQUAL((*perm5)*unitVec[2],unitVec[1]);
 | 
|---|
| [5630bd] | 350 |   CPPUNIT_ASSERT_EQUAL((*perm5)*zeroVec,zeroVec);
 | 
|---|
 | 351 | 
 | 
|---|
 | 352 |   Vector t = Vector(1.,2.,3.);
 | 
|---|
 | 353 |   CPPUNIT_ASSERT_EQUAL((*perm1)*t,Vector(1,3,2));
 | 
|---|
 | 354 |   CPPUNIT_ASSERT_EQUAL((*perm2)*t,Vector(2,1,3));
 | 
|---|
 | 355 |   CPPUNIT_ASSERT_EQUAL((*perm3)*t,Vector(3,1,2));
 | 
|---|
 | 356 |   CPPUNIT_ASSERT_EQUAL((*perm4)*t,Vector(3,2,1));
 | 
|---|
 | 357 |   CPPUNIT_ASSERT_EQUAL((*perm5)*t,Vector(2,3,1));
 | 
|---|
 | 358 | }
 | 
|---|