87T
Determinant(
const boost::numeric::ublas::c_matrix<T, 3, 3>& rM)
89 using namespace boost::numeric::ublas;
91 return rM(0,0) * (rM(1,1)*rM(2,2) - rM(1,2)*rM(2,1))
92 - rM(0,1) * (rM(1,0)*rM(2,2) - rM(1,2)*rM(2,0))
93 + rM(0,2) * (rM(1,0)*rM(2,1) - rM(1,1)*rM(2,0));
123 using namespace boost::numeric::ublas;
124 return std::sqrt(rM(0,0)*rM(0,0) + rM(1,0)*rM(1,0) + rM(2,0)*rM(2,0));
228T
SubDeterminant(
const boost::numeric::ublas::c_matrix<T, 3, 3>& rM,
const unsigned missrow,
const unsigned misscol)
230 using namespace boost::numeric::ublas;
235 unsigned lorow = (missrow==0) ? 1 : 0;
236 unsigned hirow = (missrow==2) ? 1 : 2;
237 unsigned locol = (misscol==0) ? 1 : 0;
238 unsigned hicol = (misscol==2) ? 1 : 2;
239 return rM(lorow,locol)*rM(hirow,hicol) - rM(lorow,hicol)*rM(hirow,locol);
253T
SubDeterminant(
const boost::numeric::ublas::c_matrix<T, 3, 2>& rM,
const unsigned missrow,
const unsigned misscol)
255 using namespace boost::numeric::ublas;
260 unsigned lorow = (missrow==0) ? 1 : 0;
261 unsigned hirow = (missrow==2) ? 1 : 2;
262 unsigned locol = (misscol==0) ? 1 : 0;
263 unsigned hicol = (misscol==2) ? 1 : 2;
264 return rM(lorow,locol)*rM(hirow,hicol) - rM(lorow,hicol)*rM(hirow,locol);
276T
SubDeterminant(
const boost::numeric::ublas::c_matrix<T, 3, 1>& rM,
const unsigned missrow,
const unsigned misscol)
278 using namespace boost::numeric::ublas;
283 unsigned lorow = (missrow==0) ? 1 : 0;
284 unsigned hirow = (missrow==2) ? 1 : 2;
285 unsigned locol = (misscol==0) ? 1 : 0;
286 unsigned hicol = (misscol==2) ? 1 : 2;
287 return rM(lorow,locol)*rM(hirow,hicol) - rM(lorow,hicol)*rM(hirow,locol);
386boost::numeric::ublas::c_matrix<T, 2, 2>
Inverse(
const boost::numeric::ublas::c_matrix<T, 2, 2>& rM)
388 using namespace boost::numeric::ublas;
390 c_matrix<T, 2, 2> inverse;
393 assert( fabs(det) > DBL_EPSILON );
394 inverse(0,0) = rM(1,1)/det;
395 inverse(0,1) = -rM(0,1)/det;
396 inverse(1,0) = -rM(1,0)/det;
397 inverse(1,1) = rM(0,0)/det;
409boost::numeric::ublas::c_matrix<T, 3, 3>
Inverse(
const boost::numeric::ublas::c_matrix<T, 3, 3>& rM)
411 using namespace boost::numeric::ublas;
413 c_matrix<T, 3, 3> inverse;
415 assert(fabs(det) > DBL_EPSILON);
417 inverse(0,0) = (rM(1,1)*rM(2,2) - rM(1,2)*rM(2,1))/det;
418 inverse(1,0) = -(rM(1,0)*rM(2,2) - rM(1,2)*rM(2,0))/det;
419 inverse(2,0) = (rM(1,0)*rM(2,1) - rM(1,1)*rM(2,0))/det;
420 inverse(0,1) = -(rM(0,1)*rM(2,2) - rM(0,2)*rM(2,1))/det;
421 inverse(1,1) = (rM(0,0)*rM(2,2) - rM(0,2)*rM(2,0))/det;
422 inverse(2,1) = -(rM(0,0)*rM(2,1) - rM(0,1)*rM(2,0))/det;
423 inverse(0,2) = (rM(0,1)*rM(1,2) - rM(0,2)*rM(1,1))/det;
424 inverse(1,2) = -(rM(0,0)*rM(1,2) - rM(0,2)*rM(1,0))/det;
425 inverse(2,2) = (rM(0,0)*rM(1,1) - rM(0,1)*rM(1,0))/det;
440boost::numeric::ublas::c_matrix<T, 2, 3>
Inverse(
const boost::numeric::ublas::c_matrix<T, 3, 2>& rM)
442 using namespace boost::numeric::ublas;
444 c_matrix<T, 2, 3> inverse;
450 T a = rM(0,0)*rM(0,0) + rM(1,0)*rM(1,0) + rM(2,0)*rM(2,0);
451 T b = rM(0,0)*rM(0,1) + rM(1,0)*rM(1,1) + rM(2,0)*rM(2,1);
453 T d = rM(0,1)*rM(0,1) + rM(1,1)*rM(1,1) + rM(2,1)*rM(2,1);
462 inverse(0,0) = a_inv*rM(0,0) + b_inv*rM(0,1);
463 inverse(1,0) = c_inv*rM(0,0) + d_inv*rM(0,1);
464 inverse(0,1) = a_inv*rM(1,0) + b_inv*rM(1,1);
465 inverse(1,1) = c_inv*rM(1,0) + d_inv*rM(1,1);
466 inverse(0,2) = a_inv*rM(2,0) + b_inv*rM(2,1);
467 inverse(1,2) = c_inv*rM(2,0) + d_inv*rM(2,1);
480boost::numeric::ublas::c_matrix<T, 1, 2>
Inverse(
const boost::numeric::ublas::c_matrix<T, 2, 1>& rM)
482 using namespace boost::numeric::ublas;
484 c_matrix<T, 1, 2> inverse;
487 inverse(0,0) = rM(0,0)/det/det;
488 inverse(0,1) = rM(1,0)/det/det;
501boost::numeric::ublas::c_matrix<T, 1, 3>
Inverse(
const boost::numeric::ublas::c_matrix<T, 3, 1>& rM)
503 using namespace boost::numeric::ublas;
505 c_matrix<T, 1, 3> inverse;
508 inverse(0,0) = rM(0,0)/det/det;
509 inverse(0,1) = rM(1,0)/det/det;
510 inverse(0,2) = rM(2,0)/det/det;
578 return rM(0,0)*rM(1,1) + rM(1,1)*rM(2,2) + rM(2,2)*rM(0,0)
579 - rM(1,0)*rM(1,0) - rM(2,1)*rM(2,1) - rM(2,0)*rM(2,0);