vnl_diag_matrix_fixed.hxx
Go to the documentation of this file.
1 // This is core/vnl/vnl_diag_matrix_fixed.hxx
2 #ifndef vnl_diag_matrix_fixed_hxx_
3 #define vnl_diag_matrix_fixed_hxx_
4 //:
5 // \file
6 
7 #include <iostream>
9 
10 #ifdef _MSC_VER
11 # include <vcl_msvc_warnings.h>
12 #endif
13 
14 template <class T, unsigned int N>
16 vnl_diag_matrix_fixed<T, N>::begin() { return diagonal_.begin(); }
17 
18 template <class T, unsigned int N>
20 vnl_diag_matrix_fixed<T, N>::end() { return diagonal_.end(); }
21 
22 template <class T, unsigned int N>
24 vnl_diag_matrix_fixed<T, N>::begin() const { return diagonal_.begin(); }
25 
26 template <class T, unsigned int N>
28 vnl_diag_matrix_fixed<T, N>::end() const { return diagonal_.end(); }
29 
30 //: Return inv(D) * b.
31 template <class T, unsigned int N>
33 {
35  for (unsigned i = 0; i < N; ++i)
36  ret[i] = b[i] / diagonal_[i];
37  return ret;
38 }
39 
40 //: Return inv(D) * b.
41 template <class T, unsigned int N>
43 {
44  for (unsigned i = 0; i < N; ++i)
45  (*out)[i] = b[i] / diagonal_[i];
46 }
47 
48 //: Print in MATLAB diag([1 2 3]) form.
49 template <class T, unsigned int N>
50 std::ostream& operator<< (std::ostream& s, const vnl_diag_matrix_fixed<T,N>& D)
51 {
52  s << "diag([ ";
53  for (unsigned i=0; i<N; ++i)
54  s << D(i,i) << ' ';
55  return s << "])";
56 }
57 
58 #undef VNL_DIAG_MATRIX_FIXED_INSTANTIATE
59 #define VNL_DIAG_MATRIX_FIXED_INSTANTIATE(T , N ) \
60 template class VNL_EXPORT vnl_diag_matrix_fixed<T , N >; \
61 template VNL_EXPORT std::ostream& operator<< (std::ostream& s, vnl_diag_matrix_fixed<T , N > const &)
62 
63 //template bool epsilon_equals (vnl_diag_matrix_fixed<T > const & , vnl_diag_matrix_fixed<T > const & , double)
64 
65 #endif // vnl_diag_matrix_fixed_hxx_
vnl_vector_fixed< T, N >::const_iterator const_iterator
vnl_vector_fixed< T, N > solve(vnl_vector_fixed< T, N > const &b) const
Return inv(D) * b.
std::ostream & operator<<(std::ostream &s, vnl_decnum const &r)
decimal output.
Definition: vnl_decnum.h:393
stores a diagonal matrix as a single vector.
vnl_vector_fixed< T, N >::iterator iterator
Contains class for diagonal matrices.