Go to the documentation of this file.00001 #ifndef mbl_print_h_
00002 #define mbl_print_h_
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef NDEBUG // skip all this if not debugging
00011
00012 #include <vcl_iostream.h>
00013 #include <vcl_vector.h>
00014 #include <vnl/vnl_vector.h>
00015 #include <vnl/vnl_matrix.h>
00016
00017
00018
00019
00020 void mbl_print_vcl_vector_double(const vcl_vector<double>& v, int n)
00021 {
00022 if (n>int(v.size())) n=v.size();
00023 vcl_cout << "( ";
00024 for (int i=0; i<n;++i) vcl_cout << v[i] << ' ';
00025 if (n<int(v.size())) vcl_cout << "... ";
00026 vcl_cout << ")\n";
00027 }
00028
00029
00030
00031 void mbl_print_vcl_vector_double(const vcl_vector<double>& v)
00032 {
00033 int n = 5;
00034 if (n>int(v.size())) n=v.size();
00035 vcl_cout << "( ";
00036 for (int i=0; i<n ;++i) vcl_cout << v[i] << ' ';
00037 if (n<int(v.size())) vcl_cout << "... ";
00038 vcl_cout << ")\n";
00039 }
00040
00041
00042
00043 void mbl_print_vcl_vector_double(const vcl_vector<double>* v, int n)
00044 {
00045 if (n>int(v->size())) n=v->size();
00046 vcl_cout << "( ";
00047 for (int i=0; i<n ;++i) vcl_cout << (*v)[i] << ' ';
00048 if (n<int(v->size())) vcl_cout << "... ";
00049 vcl_cout << ")\n";
00050 }
00051
00052
00053
00054 void mbl_print_vcl_vector_double(const vcl_vector<double>* v)
00055 {
00056 int n = 5;
00057 if (n>int(v->size())) n=v->size();
00058 vcl_cout << "( ";
00059 for (int i=0; i<n ;++i) vcl_cout << (*v)[i] << ' ';
00060 if (n<int(v->size())) vcl_cout << "... ";
00061 vcl_cout << ")\n";
00062 }
00063
00064
00065
00066 void mbl_print_vcl_vector_unsigned(const vcl_vector<unsigned>& v, int n)
00067 {
00068 if (n>int(v.size())) n=v.size();
00069 vcl_cout << "( ";
00070 for (int i=0; i<n ;++i) vcl_cout << (v)[i] << ' ';
00071 if (n<int(v.size())) vcl_cout << "... ";
00072 vcl_cout << ")\n";
00073 }
00074
00075
00076
00077 void mbl_print_vcl_vector_unsigned(const vcl_vector<unsigned>& v)
00078 {
00079 int n = 5;
00080 if (n>int(v.size())) n=v.size();
00081 vcl_cout << "( ";
00082 for (int i=0; i<n ;++i) vcl_cout << (v)[i] << ' ';
00083 if (n<int(v.size())) vcl_cout << "... ";
00084 vcl_cout << ")\n";
00085 }
00086
00087
00088
00089 void mbl_print_vcl_vector_unsigned(const vcl_vector<unsigned>* v, int n)
00090 {
00091 if (n>int(v->size())) n=v->size();
00092 vcl_cout << "( ";
00093 for (int i=0; i<n ;++i) vcl_cout << (*v)[i] << ' ';
00094 if (n<int(v->size())) vcl_cout << "... ";
00095 vcl_cout << ")\n";
00096 }
00097
00098
00099
00100 void mbl_print_vcl_vector_unsigned(const vcl_vector<unsigned>* v)
00101 {
00102 int n = 5;
00103 if (n>int(v->size())) n=v->size();
00104 vcl_cout << "( ";
00105 for (int i=0; i<n ;++i) vcl_cout << (*v)[i] << ' ';
00106 if (n<int(v->size())) vcl_cout << "... ";
00107 vcl_cout << ")\n";
00108 }
00109
00110
00111
00112 void mbl_print_vcl_vector_int(const vcl_vector<int>& v, int n)
00113 {
00114 if (n>int(v.size())) n=v.size();
00115 vcl_cout << "( ";
00116 for (int i=0; i<n ;++i) vcl_cout << (v)[i] << ' ';
00117 if (n<int(v.size())) vcl_cout << "... ";
00118 vcl_cout << ")\n";
00119 }
00120
00121
00122
00123 void mbl_print_vcl_vector_int(const vcl_vector<int>& v)
00124 {
00125 int n = 5;
00126 if (n>int(v.size())) n=v.size();
00127 vcl_cout << "( ";
00128 for (int i=0; i<n ;++i) vcl_cout << (v)[i] << ' ';
00129 if (n<int(v.size())) vcl_cout << "... ";
00130 vcl_cout << ")\n";
00131 }
00132
00133
00134
00135 void mbl_print_vcl_vector_int(const vcl_vector<int>* v, int n)
00136 {
00137 if (n>int(v->size())) n=v->size();
00138 vcl_cout << "( ";
00139 for (int i=0; i<n ;++i) vcl_cout << (*v)[i] << ' ';
00140 if (n<int(v->size())) vcl_cout << "... ";
00141 vcl_cout << ")\n";
00142 }
00143
00144
00145
00146 void mbl_print_vcl_vector_int(const vcl_vector<int>* v)
00147 {
00148 int n = 5;
00149 if (n>int(v->size())) n=v->size();
00150 vcl_cout << "( ";
00151 for (int i=0; i<n ;++i) vcl_cout << (*v)[i] << ' ';
00152 if (n<int(v->size())) vcl_cout << "... ";
00153 vcl_cout << ")\n";
00154 }
00155
00156
00157
00158 void mbl_print_vnl_vecd(const vnl_vector<double>* v, int n)
00159 {
00160 if (n>int(v->size())) n=v->size();
00161 vcl_cout << "( ";
00162 for (int i=0;i<n;++i) vcl_cout << (*v)(i) << ' ';
00163 if (n<int(v->size())) vcl_cout << "... ";
00164 vcl_cout << ")\n";
00165 }
00166
00167
00168
00169 void mbl_print_vnl_vecd(const vnl_vector<double>* v)
00170 {
00171 int n = 5;
00172 if (n>int(v->size())) n=v->size();
00173 vcl_cout << "( ";
00174 for (int i=0;i<n;++i) vcl_cout << (*v)(i) << ' ';
00175 if (n<int(v->size())) vcl_cout << "... ";
00176 vcl_cout << ")\n";
00177 }
00178
00179
00180
00181 void mbl_print_vnl_matd(const vnl_matrix<double>* A, int m, int n)
00182 {
00183 vcl_cout << A->rows() << " by " << A->columns() << " Matrix\n";
00184
00185 if (m>int(A->rows())) m=A->rows();
00186 if (n>int(A->columns())) n=A->columns();
00187
00188 for (int i=0;i<m;++i)
00189 {
00190 vcl_cout << "( ";
00191
00192 for (int j=0; j<n; ++j)
00193 vcl_cout << (*A)(i,j) << ' ';
00194 if (n<int(A->columns())) vcl_cout << "... ";
00195 vcl_cout << ")\n";
00196 }
00197 if (m<int(A->rows())) vcl_cout << "( ... )\n";
00198 }
00199
00200
00201
00202 void mbl_print_vnl_matd(const vnl_matrix<double>* A)
00203 {
00204 int m = 5; int n = 5;
00205 vcl_cout << A->rows() << " by " << A->columns() << " Matrix\n";
00206
00207 if (m>int(A->rows())) m=A->rows();
00208 if (n>int(A->columns())) n=A->columns();
00209
00210 for (int i=0;i<m;++i)
00211 {
00212 vcl_cout << "( ";
00213
00214 for ( int j=0; j<n; ++j)
00215 vcl_cout << (*A)(i,j) << ' ';
00216 if (n<int(A->columns())) vcl_cout << "... ";
00217 vcl_cout << ")\n";
00218 }
00219 if (m<int(A->rows())) vcl_cout << "( ... )\n";
00220 }
00221
00222 void mbl_print_carray_double(const double* v, int n)
00223 {
00224 vcl_cout << "( ";
00225 for (int i=0; i<n ;++i) vcl_cout << v[i] << ' ';
00226 vcl_cout << ")\n";
00227 }
00228
00229 #endif // NDEBUG // skip all this if not debugging
00230
00231 #endif // mbl_print_h_