core/vnl/vnl_linear_operators_3.h
Go to the documentation of this file.
00001 // This is core/vnl/vnl_linear_operators_3.h
00002 #ifndef vnl_linear_operators_3_h_
00003 #define vnl_linear_operators_3_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief 3D linear algebra operations
00010 // \author Andrew W. Fitzgibbon, Oxford RRG
00011 // \date   04 Aug 96
00012 //
00013 //  Specialized linear operators for 3D vectors and matrices.
00014 //  Include this file if you're inlining or compiling linear algebra
00015 //  code for speed.
00016 //
00017 // \verbatim
00018 //  Modifications
00019 //   LSB (Manchester) 23/3/01 Tidied documentation
00020 // \endverbatim
00021 //-----------------------------------------------------------------------------
00022 
00023 #include <vnl/vnl_double_3.h>
00024 #include <vnl/vnl_double_3x3.h>
00025 
00026 //: The binary multiplication operator
00027 // \relatesalso vnl_matrix_fixed
00028 inline
00029 vnl_double_3 operator* (const vnl_double_3x3& A, const vnl_double_3& x)
00030 {
00031   const double* a = A.data_block();
00032   double r0 = a[0] * x[0] + a[1] * x[1] + a[2] * x[2];
00033   double r1 = a[3] * x[0] + a[4] * x[1] + a[5] * x[2];
00034   double r2 = a[6] * x[0] + a[7] * x[1] + a[8] * x[2];
00035   return vnl_double_3(r0, r1, r2);
00036 }
00037 
00038 //: The binary addition operator
00039 // \relatesalso vnl_vector_fixed
00040 inline
00041 vnl_double_3 operator+ (const vnl_double_3& a, const vnl_double_3& b)
00042 {
00043   double r0 = a[0] + b[0];
00044   double r1 = a[1] + b[1];
00045   double r2 = a[2] + b[2];
00046   return vnl_double_3(r0, r1, r2);
00047 }
00048 
00049 #endif // vnl_linear_operators_3_h_