00001
00002 #ifndef vnl_matrix_fixed_ref_h_
00003 #define vnl_matrix_fixed_ref_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 #include <vcl_cassert.h>
00145 #include <vcl_iosfwd.h>
00146 #include <vcl_cstring.h>
00147 #include <vnl/vnl_matrix_fixed.h>
00148 #include <vnl/vnl_vector_fixed.h>
00149 #include <vnl/vnl_vector_fixed_ref.h>
00150 #include <vnl/vnl_c_vector.h>
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 template <class T, unsigned num_rows, unsigned num_cols>
00170 class vnl_matrix_fixed_ref_const
00171 {
00172 protected:
00173 const T* data_;
00174 public:
00175 vnl_matrix_fixed_ref_const(const vnl_matrix_fixed<T,num_rows,num_cols>& rhs)
00176 : data_(rhs.data_block())
00177 {
00178 }
00179 explicit vnl_matrix_fixed_ref_const(const T * dataptr)
00180 : data_(dataptr)
00181 {
00182 }
00183 vnl_matrix_fixed_ref_const(const vnl_matrix_fixed_ref_const<T,num_rows,num_cols> & rhs)
00184 : data_(rhs.data_)
00185 {
00186 }
00187
00188 vnl_vector_fixed<T,num_rows> get_row(unsigned row_index) const
00189 {
00190 vnl_vector<T> v(num_cols);
00191 for (unsigned int j = 0; j < num_cols; j++)
00192 v[j] = (*this)(row_index,j);
00193 return v;
00194 }
00195
00196
00197 vnl_vector_fixed<T,num_cols> get_column(unsigned column_index) const
00198 {
00199 vnl_vector<T> v(num_rows);
00200 for (unsigned int j = 0; j < num_rows; j++)
00201 v[j] = (*this)(j,column_index);
00202 return v;
00203 }
00204 const T * data_block() const { return data_; }
00205
00206
00207 typedef T const *const_iterator;
00208
00209 const_iterator begin() const { return data_; }
00210
00211 const_iterator end() const { return begin() + this->size(); }
00212
00213
00214 typedef const T element_type;
00215
00216 typedef const T *iterator;
00217
00218 T const & operator() (unsigned r, unsigned c) const
00219 {
00220 #if VNL_CONFIG_CHECK_BOUNDS && (!defined NDEBUG)
00221 assert(r<num_rows);
00222 assert(c<num_cols);
00223 #endif
00224 return *(data_ + num_cols * r + c);
00225 }
00226
00227
00228
00229 T const * operator[] (unsigned r) const { return data_ + num_cols * r; }
00230
00231
00232 unsigned rows() const { return num_rows; }
00233
00234
00235
00236 unsigned columns() const { return num_cols; }
00237
00238
00239
00240 unsigned cols() const { return num_cols; }
00241
00242
00243
00244 unsigned size() const { return num_rows*num_cols; }
00245
00246
00247 void print(vcl_ostream& os) const;
00248
00249 void copy_out(T *) const;
00250
00251
00252
00253
00254 vnl_matrix_fixed<T,num_rows,num_cols> apply(T (*f)(T)) const;
00255
00256
00257 vnl_matrix_fixed<T,num_rows,num_cols> apply(T (*f)(T const&)) const;
00258
00259
00260 vnl_matrix_fixed<T,num_cols,num_rows> transpose () const;
00261
00262
00263 vnl_matrix_fixed<T,num_cols,num_rows> conjugate_transpose () const;
00264
00265
00266
00267 vnl_matrix<T> extract (unsigned rowz, unsigned colz,
00268 unsigned top=0, unsigned left=0) const;
00269
00270
00271 vnl_matrix<T> get_n_rows (unsigned rowstart, unsigned n) const;
00272
00273
00274 vnl_matrix<T> get_n_columns(unsigned colstart, unsigned n) const;
00275
00276
00277 typedef typename vnl_c_vector<T>::abs_t abs_t;
00278
00279
00280 abs_t array_one_norm() const { return vnl_c_vector<T>::one_norm(begin(), size()); }
00281
00282
00283 abs_t array_two_norm() const { return vnl_c_vector<T>::two_norm(begin(), size()); }
00284
00285
00286 abs_t array_inf_norm() const { return vnl_c_vector<T>::inf_norm(begin(), size()); }
00287
00288
00289 abs_t absolute_value_sum() const { return array_one_norm(); }
00290
00291
00292 abs_t absolute_value_max() const { return array_inf_norm(); }
00293
00294
00295 abs_t operator_one_norm() const;
00296
00297
00298 abs_t operator_inf_norm() const;
00299
00300
00301 abs_t frobenius_norm() const { return vnl_c_vector<T>::two_norm(begin(), size()); }
00302
00303
00304 abs_t fro_norm() const { return frobenius_norm(); }
00305
00306
00307 abs_t rms() const { return vnl_c_vector<T>::rms_norm(begin(), size()); }
00308
00309
00310 T min_value() const { return vnl_c_vector<T>::min_value(begin(), size()); }
00311
00312
00313 T max_value() const { return vnl_c_vector<T>::max_value(begin(), size()); }
00314
00315
00316 unsigned arg_min() const { return vnl_c_vector<T>::arg_min(begin(), size()); }
00317
00318
00319 unsigned arg_max() const { return vnl_c_vector<T>::arg_max(begin(), size()); }
00320
00321
00322 T mean() const { return vnl_c_vector<T>::mean(begin(), size()); }
00323
00324
00325
00326
00327 bool empty() const { return num_rows==0 && num_cols==0; }
00328
00329
00330 bool is_identity() const;
00331
00332
00333 bool is_identity(double tol) const;
00334
00335
00336 bool is_zero() const;
00337
00338
00339 bool is_zero(double tol) const;
00340
00341
00342 bool is_finite() const;
00343
00344
00345 bool has_nans() const;
00346
00347
00348
00349 void assert_size(unsigned rowz, unsigned colz) const
00350 {
00351 #ifndef NDEBUG
00352 assert_size_internal(rowz, colz);
00353 #endif
00354 }
00355
00356
00357 void assert_finite() const
00358 {
00359 #ifndef NDEBUG
00360 assert_finite_internal();
00361 #endif
00362 }
00363
00364 static void add( const T* a, const T* b, T* r ) { vnl_matrix_fixed<T,num_rows,num_cols>::add(a,b,r); }
00365 static void add( const T* a, T b, T* r ) { vnl_matrix_fixed<T,num_rows,num_cols>::add(a,b,r); }
00366 static void sub( const T* a, const T* b, T* r ) { vnl_matrix_fixed<T,num_rows,num_cols>::sub(a,b,r); }
00367 static void sub( const T* a, T b, T* r ) { vnl_matrix_fixed<T,num_rows,num_cols>::sub(a,b,r); }
00368 static void sub( T a, const T* b, T* r ) { vnl_matrix_fixed<T,num_rows,num_cols>::sub(a,b,r); }
00369 static void mul( const T* a, const T* b, T* r ) { vnl_matrix_fixed<T,num_rows,num_cols>::mul(a,b,r); }
00370 static void mul( const T* a, T b, T* r ) { vnl_matrix_fixed<T,num_rows,num_cols>::mul(a,b,r); }
00371 static void div( const T* a, const T* b, T* r ) { vnl_matrix_fixed<T,num_rows,num_cols>::div(a,b,r); }
00372 static void div( const T* a, T b, T* r ) { vnl_matrix_fixed<T,num_rows,num_cols>::div(a,b,r); }
00373
00374 static bool equal( const T* a, const T* b ) { return vnl_matrix_fixed<T,num_rows,num_cols>::equal(a,b); }
00375
00376 private:
00377 const vnl_matrix_fixed_ref_const<T,num_rows,num_cols> & operator=(const vnl_matrix_fixed_ref_const<T,num_rows,num_cols>& ) const
00378 {
00379 assert(!"Assignment is illegal for a vnl_matrix_fixed_ref_const");
00380 return *this;
00381 }
00382
00383 void assert_finite_internal() const;
00384
00385 void assert_size_internal(unsigned, unsigned) const;
00386 };
00387
00388
00389 template <class T, unsigned num_rows, unsigned num_cols>
00390 class vnl_matrix_fixed_ref : public vnl_matrix_fixed_ref_const<T,num_rows,num_cols>
00391 {
00392 typedef vnl_matrix_fixed_ref_const<T,num_rows,num_cols> base;
00393
00394 public:
00395
00396
00397 T * data_block() const {
00398 return const_cast<T*>(this->data_);
00399 }
00400 vnl_matrix_fixed_ref(vnl_matrix_fixed<T,num_rows,num_cols>& rhs)
00401 : base(rhs.data_block())
00402 {
00403 }
00404 explicit vnl_matrix_fixed_ref(T * dataptr)
00405 : base(dataptr)
00406 {
00407 }
00408
00409
00410 vnl_matrix_fixed_ref const & operator=(const vnl_matrix_fixed_ref_const<T,num_rows,num_cols>& rhs) const
00411 {
00412 vcl_memcpy(data_block(), rhs.data_block(), num_rows*num_cols*sizeof(T));
00413 return *this;
00414 }
00415
00416
00417
00418
00419 void put (unsigned r, unsigned c, T const& v) { (*this)(r,c) = v; }
00420
00421
00422 T get (unsigned r, unsigned c) const { return (*this)(r,c); }
00423
00424
00425
00426 T * operator[] (unsigned r) const { return data_block() + num_cols * r; }
00427
00428
00429
00430 T & operator() (unsigned r, unsigned c) const
00431 {
00432 #if VNL_CONFIG_CHECK_BOUNDS && (!defined NDEBUG)
00433 assert(r<num_rows);
00434 assert(c<num_cols);
00435 #endif
00436 return *(this->data_block() + num_cols * r + c);
00437 }
00438
00439
00440
00441
00442
00443 void fill (T) const;
00444
00445
00446
00447 void fill_diagonal (T) const;
00448
00449
00450
00451 void copy_in(T const *) const;
00452
00453
00454
00455 void set(T const *d) const { copy_in(d); }
00456
00457
00458
00459
00460
00461
00462 void inplace_transpose() const;
00463
00464
00465
00466
00467
00468
00469 vnl_matrix_fixed_ref const& operator+= (T s) const
00470 {
00471 base::add( data_block(), s, data_block() ); return *this;
00472 }
00473
00474
00475 vnl_matrix_fixed_ref const& operator-= (T s) const
00476 {
00477 base::sub( data_block(), s, data_block() ); return *this;
00478 }
00479
00480
00481 vnl_matrix_fixed_ref const& operator*= (T s) const
00482 {
00483 base::mul( data_block(), s, data_block() ); return *this;
00484 }
00485
00486
00487 vnl_matrix_fixed_ref const& operator/= (T s) const
00488 {
00489 base::div( data_block(), s, data_block() ); return *this;
00490 }
00491
00492
00493 vnl_matrix_fixed_ref const & operator+= (vnl_matrix_fixed_ref_const<T,num_rows,num_cols> const& m) const
00494 {
00495 base::add( data_block(), m.data_block(), data_block() ); return *this;
00496 }
00497
00498
00499 vnl_matrix_fixed_ref const& operator+= (vnl_matrix<T> const& m) const
00500 {
00501 assert( m.rows() == num_rows && m.cols() == num_cols );
00502 base::add( data_block(), m.data_block(), data_block() ); return *this;
00503 }
00504
00505
00506 vnl_matrix_fixed_ref const& operator-= (vnl_matrix_fixed_ref_const<T,num_rows,num_cols> const& m) const
00507 {
00508 base::sub( data_block(), m.data_block(), data_block() ); return *this;
00509 }
00510
00511
00512 vnl_matrix_fixed_ref const& operator-= (vnl_matrix<T> const& m) const
00513 {
00514 assert( m.rows() == num_rows && m.cols() == num_cols );
00515 base::sub( data_block(), m.data_block(), data_block() ); return *this;
00516 }
00517
00518
00519 vnl_matrix_fixed<T,num_rows,num_cols> operator- () const
00520 {
00521 vnl_matrix_fixed<T,num_rows,num_cols> r;
00522 base::sub( T(0), data_block(), r.data_block() );
00523 return r;
00524 }
00525
00526
00527 vnl_matrix_fixed_ref const& operator*= (vnl_matrix_fixed_ref_const<T,num_cols,num_cols> const& s) const
00528 {
00529 vnl_matrix_fixed<T, num_rows, num_cols> out;
00530 for (unsigned i = 0; i < num_rows; ++i)
00531 for (unsigned j = 0; j < num_cols; ++j)
00532 {
00533 T accum = this->operator()(i,0) * s(0,j);
00534 for (unsigned k = 1; k < num_cols; ++k)
00535 accum += this->operator()(i,k) * s(k,j);
00536 out(i,j) = accum;
00537 }
00538 *this = out;
00539 return *this;
00540 }
00541
00542 #ifdef VCL_VC_6
00543 template<unsigned o>
00544 vnl_matrix_fixed<T,num_rows,o> operator*( vnl_matrix_fixed_fake_base<o,num_cols,T> const& mat ) const
00545 {
00546 vnl_matrix_fixed<T,num_cols,o> const& b = static_cast<vnl_matrix_fixed<T,num_cols,o> const&>(mat);
00547 return vnl_matrix_fixed_mat_mat_mult<T,num_rows,num_cols,o>( *this, b );
00548 }
00549 vnl_vector_fixed<T, num_rows> operator*( vnl_vector_fixed_ref_const<T, num_cols> const& b) const
00550 {
00551 return vnl_matrix_fixed_mat_vec_mult<T,num_rows,num_cols>(*this,b);
00552 }
00553 #endif
00554
00555
00556 vnl_matrix_fixed_ref const & update (vnl_matrix<T> const&, unsigned top=0, unsigned left=0) const;
00557
00558
00559 void set_column(unsigned i, T const * v) const;
00560
00561
00562 void set_column(unsigned i, T value ) const;
00563
00564
00565 void set_column(unsigned j, vnl_vector<T> const& v) const;
00566
00567
00568 void set_columns(unsigned starting_column, vnl_matrix<T> const& M) const;
00569
00570
00571 void set_row (unsigned i, T const * v) const;
00572
00573
00574 void set_row (unsigned i, T value ) const;
00575
00576
00577 void set_row (unsigned i, vnl_vector<T> const&) const;
00578
00579
00580
00581
00582
00583 void set_identity() const;
00584
00585
00586 void flipud() const;
00587
00588
00589 void fliplr() const;
00590
00591
00592
00593 void normalize_rows() const;
00594
00595
00596
00597 void normalize_columns() const;
00598
00599
00600 void scale_row (unsigned row, T value) const;
00601
00602
00603 void scale_column(unsigned col, T value) const;
00604
00605
00606
00607
00608 bool read_ascii(vcl_istream& s) const;
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623 vnl_matrix_ref<T> as_ref() { return vnl_matrix_ref<T>( num_rows, num_cols, data_block() ); }
00624
00625
00626
00627
00628
00629
00630 const vnl_matrix_ref<T> as_ref() const { return vnl_matrix_ref<T>( num_rows, num_cols, const_cast<T*>(data_block()) ); }
00631
00632
00633
00634
00635
00636 operator const vnl_matrix_ref<T>() const { return vnl_matrix_ref<T>( num_rows, num_cols, const_cast<T*>(data_block()) ); }
00637
00638
00639 const vnl_matrix<T> as_matrix() const { return vnl_matrix<T>(const_cast<T*>(data_block()),num_rows,num_cols); }
00640
00641
00642
00643 typedef T element_type;
00644
00645
00646 typedef T *iterator;
00647
00648 iterator begin() const { return data_block(); }
00649
00650 iterator end() const { return begin() + this->size(); }
00651
00652
00653
00654 bool operator_eq (vnl_matrix_fixed_ref_const<T,num_rows,num_cols> const & rhs) const
00655 {
00656 return equal( this->data_block(), rhs.data_block() );
00657 }
00658
00659
00660 bool operator==(vnl_matrix_fixed_ref_const<T,num_rows,num_cols> const &that) const { return this->operator_eq(that); }
00661
00662
00663 bool operator!=(vnl_matrix_fixed_ref_const<T,num_rows,num_cols> const &that) const { return !this->operator_eq(that); }
00664
00665
00666 };
00667
00668 #undef VNL_MATRIX_FIXED_VCL60_WORKAROUND
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679 template<class T, unsigned m, unsigned n>
00680 inline
00681 vnl_matrix_fixed<T,m,n> operator+( const vnl_matrix_fixed_ref_const<T,m,n>& mat1, const vnl_matrix_fixed_ref_const<T,m,n>& mat2 )
00682 {
00683 vnl_matrix_fixed<T,m,n> r;
00684 vnl_matrix_fixed<T,m,n>::add( mat1.data_block(), mat2.data_block(), r.data_block() );
00685 return r;
00686 }
00687
00688 template<class T, unsigned m, unsigned n>
00689 inline
00690 vnl_matrix_fixed<T,m,n> operator+( const vnl_matrix_fixed_ref_const<T,m,n>& mat, T s )
00691 {
00692 vnl_matrix_fixed<T,m,n> r;
00693 vnl_matrix_fixed<T,m,n>::add( mat.data_block(), s, r.data_block() );
00694 return r;
00695 }
00696
00697 template<class T, unsigned m, unsigned n>
00698 inline
00699 vnl_matrix_fixed<T,m,n> operator+( T s, const vnl_matrix_fixed_ref_const<T,m,n>& mat )
00700 {
00701 vnl_matrix_fixed<T,m,n> r;
00702 vnl_matrix_fixed<T,m,n>::add( mat.data_block(), s, r.data_block() );
00703 return r;
00704 }
00705
00706 template<class T, unsigned m, unsigned n>
00707 inline
00708 vnl_matrix_fixed<T,m,n> operator-( const vnl_matrix_fixed_ref_const<T,m,n>& mat1, const vnl_matrix_fixed_ref_const<T,m,n>& mat2 )
00709 {
00710 vnl_matrix_fixed<T,m,n> r;
00711 vnl_matrix_fixed<T,m,n>::sub( mat1.data_block(), mat2.data_block(), r.data_block() );
00712 return r;
00713 }
00714
00715 template<class T, unsigned m, unsigned n>
00716 inline
00717 vnl_matrix_fixed<T,m,n> operator-( const vnl_matrix_fixed_ref_const<T,m,n>& mat, T s )
00718 {
00719 vnl_matrix_fixed<T,m,n> r;
00720 vnl_matrix_fixed<T,m,n>::sub( mat.data_block(), s, r.data_block() );
00721 return r;
00722 }
00723
00724 template<class T, unsigned m, unsigned n>
00725 inline
00726 vnl_matrix_fixed<T,m,n> operator-( T s, const vnl_matrix_fixed_ref_const<T,m,n>& mat )
00727 {
00728 vnl_matrix_fixed<T,m,n> r;
00729 vnl_matrix_fixed<T,m,n>::sub( s, mat.data_block(), r.data_block() );
00730 return r;
00731 }
00732
00733 template<class T, unsigned m, unsigned n>
00734 inline
00735 vnl_matrix_fixed<T,m,n> operator*( const vnl_matrix_fixed_ref_const<T,m,n>& mat, T s )
00736 {
00737 vnl_matrix_fixed<T,m,n> r;
00738 vnl_matrix_fixed<T,m,n>::mul( mat.data_block(), s, r.data_block() );
00739 return r;
00740 }
00741
00742 template<class T, unsigned m, unsigned n>
00743 inline
00744 vnl_matrix_fixed<T,m,n> operator*( T s, const vnl_matrix_fixed_ref_const<T,m,n>& mat )
00745 {
00746 vnl_matrix_fixed<T,m,n> r;
00747 vnl_matrix_fixed<T,m,n>::mul( mat.data_block(), s, r.data_block() );
00748 return r;
00749 }
00750
00751 template<class T, unsigned m, unsigned n>
00752 inline
00753 vnl_matrix_fixed<T,m,n> operator/( const vnl_matrix_fixed_ref_const<T,m,n>& mat, T s )
00754 {
00755 vnl_matrix_fixed<T,m,n> r;
00756 vnl_matrix_fixed<T,m,n>::div( mat.data_block(), s, r.data_block() );
00757 return r;
00758 }
00759
00760
00761 template<class T, unsigned m, unsigned n>
00762 inline
00763 vnl_matrix_fixed<T,m,n> element_product( const vnl_matrix_fixed_ref_const<T,m,n>& mat1,
00764 const vnl_matrix_fixed_ref_const<T,m,n>& mat2 )
00765 {
00766 vnl_matrix_fixed<T,m,n> r;
00767 vnl_matrix_fixed<T,m,n>::mul( mat1.data_block(), mat2.data_block(), r.data_block() );
00768 return r;
00769 }
00770
00771
00772 template<class T, unsigned m, unsigned n>
00773 inline
00774 vnl_matrix_fixed<T,m,n> element_quotient( const vnl_matrix_fixed_ref_const<T,m,n>& mat1,
00775 const vnl_matrix_fixed_ref_const<T,m,n>& mat2)
00776 {
00777 vnl_matrix_fixed<T,m,n> r;
00778 vnl_matrix_fixed<T,m,n>::div( mat1.data_block(), mat2.data_block(), r.data_block() );
00779 return r;
00780 }
00781
00782
00783
00784
00785
00786 template <class T, unsigned M, unsigned N>
00787 inline
00788 vnl_vector_fixed<T, M>
00789 vnl_matrix_fixed_mat_vec_mult(const vnl_matrix_fixed_ref_const<T, M, N>& a,
00790 const vnl_vector_fixed_ref_const<T, N>& b)
00791 {
00792 vnl_vector_fixed<T, M> out;
00793 for (unsigned i = 0; i < M; ++i)
00794 {
00795 T accum = a(i,0) * b(0);
00796 for (unsigned k = 1; k < N; ++k)
00797 accum += a(i,k) * b(k);
00798 out(i) = accum;
00799 }
00800 return out;
00801 }
00802
00803
00804 template <class T, unsigned M, unsigned N, unsigned O>
00805 inline
00806 vnl_matrix_fixed<T, M, O>
00807 vnl_matrix_fixed_mat_mat_mult(const vnl_matrix_fixed_ref_const<T, M, N>& a,
00808 const vnl_matrix_fixed_ref_const<T, N, O>& b)
00809 {
00810 vnl_matrix_fixed<T, M, O> out;
00811 for (unsigned i = 0; i < M; ++i)
00812 for (unsigned j = 0; j < O; ++j)
00813 {
00814 T accum = a(i,0) * b(0,j);
00815 for (unsigned k = 1; k < N; ++k)
00816 accum += a(i,k) * b(k,j);
00817 out(i,j) = accum;
00818 }
00819 return out;
00820 }
00821
00822 #ifndef VCL_VC_6
00823
00824
00825
00826
00827
00828 template <class T, unsigned M, unsigned N>
00829 inline
00830 vnl_vector_fixed<T, M> operator*(const vnl_matrix_fixed_ref_const<T, M, N>& a, const vnl_vector_fixed_ref_const<T, N>& b)
00831 {
00832 return vnl_matrix_fixed_mat_vec_mult(a,b);
00833 }
00834
00835
00836
00837 template <class T, unsigned M, unsigned N, unsigned O>
00838 inline
00839 vnl_matrix_fixed<T, M, O> operator*(const vnl_matrix_fixed_ref_const<T, M, N>& a, const vnl_matrix_fixed_ref_const<T, N, O>& b)
00840 {
00841 return vnl_matrix_fixed_mat_mat_mult(a,b);
00842 }
00843 #endif // ! VCL_VC_6
00844
00845
00846
00847
00848
00849
00850 template<class T, unsigned m, unsigned n>
00851 inline vnl_matrix<T> operator+( const vnl_matrix_fixed_ref_const<T,m,n>& a, const vnl_matrix<T>& b )
00852 {
00853 return a.as_ref() + b;
00854 }
00855
00856 template<class T, unsigned m, unsigned n>
00857 inline vnl_matrix<T> operator+( const vnl_matrix<T>& a, const vnl_matrix_fixed_ref_const<T,m,n>& b )
00858 {
00859 return a + b.as_ref();
00860 }
00861
00862 template<class T, unsigned m, unsigned n>
00863 inline vnl_matrix<T> operator-( const vnl_matrix_fixed_ref_const<T,m,n>& a, const vnl_matrix<T>& b )
00864 {
00865 return a.as_ref() - b;
00866 }
00867
00868 template<class T, unsigned m, unsigned n>
00869 inline vnl_matrix<T> operator-( const vnl_matrix<T>& a, const vnl_matrix_fixed_ref_const<T,m,n>& b )
00870 {
00871 return a - b.as_ref();
00872 }
00873
00874 template<class T, unsigned m, unsigned n>
00875 inline vnl_matrix<T> operator*( const vnl_matrix_fixed_ref_const<T,m,n>& a, const vnl_matrix<T>& b )
00876 {
00877 return a.as_ref() * b;
00878 }
00879
00880 template<class T, unsigned m, unsigned n>
00881 inline vnl_matrix<T> operator*( const vnl_matrix<T>& a, const vnl_matrix_fixed_ref_const<T,m,n>& b )
00882 {
00883 return a * b.as_ref();
00884 }
00885
00886 template<class T, unsigned m, unsigned n>
00887 inline vnl_vector<T> operator*( const vnl_matrix_fixed_ref_const<T,m,n>& a, const vnl_vector<T>& b )
00888 {
00889 return a.as_ref() * b;
00890 }
00891
00892 template<class T, unsigned n>
00893 inline vnl_vector<T> operator*( const vnl_matrix<T>& a, const vnl_vector_fixed_ref_const<T,n>& b )
00894 {
00895 return a * b.as_ref();
00896 }
00897
00898
00899
00900
00901 template<class T, unsigned m, unsigned n>
00902 inline
00903 vcl_ostream& operator<< (vcl_ostream& os, vnl_matrix_fixed_ref_const<T,m,n> const& mat)
00904 {
00905 mat.print(os);
00906 return os;
00907 }
00908
00909 template<class T, unsigned m, unsigned n>
00910 inline
00911 vcl_istream& operator>> (vcl_istream& is, vnl_matrix_fixed_ref<T,m,n> const& mat)
00912 {
00913 mat.read_ascii(is);
00914 return is;
00915 }
00916
00917
00918 #endif // vnl_matrix_fixed_ref_h_