All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Vector.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_MATH_VECTOR_H_
23 #define _BLAZE_MATH_VECTOR_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
30 #include <iomanip>
31 #include <ostream>
35 
36 
37 namespace blaze {
38 
39 //=================================================================================================
40 //
41 // GLOBAL OPERATORS
42 //
43 //=================================================================================================
44 
45 //*************************************************************************************************
48 template< typename T1, typename T2 >
49 inline const typename MultTrait<typename T1::ElementType,typename T2::ElementType>::Type
50  operator,( const Vector<T1,false>& lhs, const Vector<T2,false>& rhs );
51 
52 template< typename T1, typename T2 >
53 inline const typename MultTrait<typename T1::ElementType,typename T2::ElementType>::Type
54  operator,( const Vector<T1,false>& lhs, const Vector<T2,true>& rhs );
55 
56 template< typename T1, typename T2 >
57 inline const typename MultTrait<typename T1::ElementType,typename T2::ElementType>::Type
58  operator,( const Vector<T1,true>& lhs, const Vector<T2,false>& rhs );
59 
60 template< typename T1, typename T2 >
61 inline const typename MultTrait<typename T1::ElementType,typename T2::ElementType>::Type
62  operator,( const Vector<T1,true>& lhs, const Vector<T2,true>& rhs );
63 
64 template< typename VT, bool TF >
65 inline std::ostream& operator<<( std::ostream& os, const Vector<VT,TF>& dv );
67 //*************************************************************************************************
68 
69 
70 //*************************************************************************************************
79 template< typename T1 // Type of the left-hand side vector
80  , typename T2 > // Type of the right-hand side vector
81 inline const typename MultTrait<typename T1::ElementType,typename T2::ElementType>::Type
82  operator,( const Vector<T1,false>& lhs, const Vector<T2,false>& rhs )
83 {
84  return trans(~lhs) * (~rhs);
85 }
86 //*************************************************************************************************
87 
88 
89 //*************************************************************************************************
98 template< typename T1 // Type of the left-hand side vector
99  , typename T2 > // Type of the right-hand side vector
100 inline const typename MultTrait<typename T1::ElementType,typename T2::ElementType>::Type
101  operator,( const Vector<T1,false>& lhs, const Vector<T2,true>& rhs )
102 {
103  return trans(~lhs) * trans(~rhs);
104 }
105 //*************************************************************************************************
106 
107 
108 //*************************************************************************************************
117 template< typename T1 // Type of the left-hand side vector
118  , typename T2 > // Type of the right-hand side vector
119 inline const typename MultTrait<typename T1::ElementType,typename T2::ElementType>::Type
120  operator,( const Vector<T1,true>& lhs, const Vector<T2,false>& rhs )
121 {
122  return (~lhs) * (~rhs);
123 }
124 //*************************************************************************************************
125 
126 
127 //*************************************************************************************************
136 template< typename T1 // Type of the left-hand side vector
137  , typename T2 > // Type of the right-hand side vector
138 inline const typename MultTrait<typename T1::ElementType,typename T2::ElementType>::Type
139  operator,( const Vector<T1,true>& lhs, const Vector<T2,true>& rhs )
140 {
141  return (~lhs) * trans(~rhs);
142 }
143 //*************************************************************************************************
144 
145 
146 //*************************************************************************************************
154 template< typename VT // Type of the vector
155  , bool TF > // Transpose flag
156 inline std::ostream& operator<<( std::ostream& os, const Vector<VT,TF>& v )
157 {
158  if( (~v).size() == 0UL ) {
159  os << "( )\n";
160  }
161  else if( TF == rowVector ) {
162  os << "(";
163  for( size_t i=0UL; i<(~v).size(); ++i )
164  os << " " << (~v)[i];
165  os << " )\n";
166  }
167  else {
168  for( size_t i=0UL; i<(~v).size(); ++i )
169  os << "( " << std::setw( 11UL ) << (~v)[i] << " )\n";
170  }
171 
172  return os;
173 }
174 //*************************************************************************************************
175 
176 } // namespace blaze
177 
178 #endif