Commit 37c815f6 authored by Davis King's avatar Davis King
Browse files

All I did in this change was rename calls to array_to_matrix(),

vector_to_matrix(), pointer_to_column_vector(), and pointer_to_matrix() to
mat() (in addition to adding a few more mat() overloads for certain things).
parent 0d970e47
......@@ -367,7 +367,7 @@ namespace dlib
- #num_labels == the number of distinct values in labels.
- returns a vector V such that:
- V.size() == labels.size()
- max(vector_to_matrix(V))+1 == num_labels.
- max(mat(V))+1 == num_labels.
- for all valid i,j:
- if (labels[i] == labels[j]) then
- V[i] == V[j]
......
......@@ -92,7 +92,7 @@ namespace dlib
// predict next state
for (long i = 0; i < next.size(); ++i)
next(i) = filter(vector_to_matrix(data[i]));
next(i) = filter(mat(data[i]));
}
template <typename EXP>
......@@ -127,7 +127,7 @@ namespace dlib
// showing it to the rls filter so it can do its thing.
if (count >= 2)
{
filter.train(vector_to_matrix(data[i]), z(i));
filter.train(mat(data[i]), z(i));
}
// keep track of the measurements in our circular buffer
......@@ -139,7 +139,7 @@ namespace dlib
{
// predict next state
for (long i = 0; i < z.size(); ++i)
next(i) = filter(vector_to_matrix(data[i]));
next(i) = filter(mat(data[i]));
}
else
{
......
......@@ -2375,7 +2375,7 @@ namespace dlib
/*!
requires
- image_type == an implementation of array2d/array2d_kernel_abstract.h or
a dlib::matrix or something convertible to a matrix via array_to_matrix()
a dlib::matrix or something convertible to a matrix via mat()
- pixel_traits<typename image_type::type> must be defined
ensures
- #*this widget is now displaying the given image new_img.
......@@ -2790,7 +2790,7 @@ namespace dlib
/*!
requires
- image_type == an implementation of array2d/array2d_kernel_abstract.h or
a dlib::matrix or something convertible to a matrix via array_to_matrix()
a dlib::matrix or something convertible to a matrix via mat()
- pixel_traits<typename image_type::type> must be defined
ensures
- this object is properly initialized
......
......@@ -67,7 +67,7 @@ namespace dlib
)
{
COMPILE_TIME_ASSERT( pixel_traits<typename image_type::type>::has_alpha == false );
load_impl(array_to_matrix(img));
load_impl(mat(img));
}
inline void unload(
......
......@@ -102,7 +102,7 @@ namespace dlib
/*!
requires
- image_type is a dlib::matrix or something convertible to a matrix
via array_to_matrix()
via mat()
- pixel_traits<typename image_type::type>::has_alpha == false
ensures
- if (img.nr() < min_size || img.nc() < min_size) then
......
......@@ -83,7 +83,7 @@ namespace dlib
)
{
COMPILE_TIME_ASSERT( pixel_traits<typename image_type::type>::has_alpha == false );
load_impl(array_to_matrix(img));
load_impl(mat(img));
}
inline void unload(
......
......@@ -158,7 +158,7 @@ namespace dlib
/*!
requires
- image_type is a dlib::matrix or something convertible to a matrix
via array_to_matrix()
via mat()
- pixel_traits<typename image_type::type>::has_alpha == false
ensures
- if (img.nr() < min_size || img.nc() < min_size) then
......
......@@ -102,7 +102,7 @@ namespace dlib
{
const typename image_array_type::type& img = images[rects[i].first];
const rectangle rect = get_rect(img).intersect(translate_rect(rects[i].second,position));
temp += sum(matrix_cast<ptype>(subm(array_to_matrix(img), rect)));
temp += sum(matrix_cast<ptype>(subm(mat(img), rect)));
}
return static_cast<double>(temp);
......@@ -161,7 +161,7 @@ namespace dlib
{
const typename image_array_type::type& img = images[fixed_rects[i].first];
const rectangle rect = get_rect(img).intersect(translate_rect(fixed_rects[i].second,position));
temp += sum(matrix_cast<ptype>(subm(array_to_matrix(img), rect)));
temp += sum(matrix_cast<ptype>(subm(mat(img), rect)));
}
if (images.size() > 0)
......@@ -176,7 +176,7 @@ namespace dlib
const rectangle rect = get_rect(tempimg).intersect(translate_rect(window,position));
if (rect.is_empty() == false)
temp += std::max(0,max(matrix_cast<ptype>(subm(array_to_matrix(tempimg), rect))));
temp += std::max(0,max(matrix_cast<ptype>(subm(mat(tempimg), rect))));
}
}
......
......@@ -75,7 +75,7 @@ namespace dlib
if (is_same_object(dest,src))
return;
impl_assign_image(dest, array_to_matrix(src));
impl_assign_image(dest, mat(src));
}
// ----------------------------------------------------------------------------------------
......@@ -175,7 +175,7 @@ namespace dlib
if (is_same_object(dest,src))
return;
impl_assign_image_scaled(dest, array_to_matrix(src),thresh);
impl_assign_image_scaled(dest, mat(src),thresh);
}
// ----------------------------------------------------------------------------------------
......
......@@ -21,7 +21,7 @@ namespace dlib
/*!
requires
- src_image_type == is an implementation of array2d/array2d_kernel_abstract.h or
a dlib::matrix or something convertible to a matrix via array_to_matrix()
a dlib::matrix or something convertible to a matrix via mat()
- dest_image_type == is an implementation of array2d/array2d_kernel_abstract.h or
is a dlib::matrix.
- pixel_traits<typename src_image_type::type> is defined
......@@ -48,7 +48,7 @@ namespace dlib
/*!
requires
- src_image_type == is an implementation of array2d/array2d_kernel_abstract.h or
a dlib::matrix or something convertible to a matrix via array_to_matrix()
a dlib::matrix or something convertible to a matrix via mat()
- dest_image_type == is an implementation of array2d/array2d_kernel_abstract.h or
is a dlib::matrix.
- pixel_traits<typename src_image_type::type> is defined
......@@ -75,8 +75,8 @@ namespace dlib
deviation of src_img. Call the mean M and the standard deviation
D. Then the scaling from src_img to dest_img is performed using
the following mapping:
let SRC_UPPER = min(M + thresh*D, max(array_to_matrix(src_img)))
let SRC_LOWER = max(M - thresh*D, min(array_to_matrix(src_img)))
let SRC_UPPER = min(M + thresh*D, max(mat(src_img)))
let SRC_LOWER = max(M - thresh*D, min(mat(src_img)))
let DEST_UPPER = pixel_traits<dest_image_type::type>::max()
let DEST_LOWER = pixel_traits<dest_image_type::type>::min()
......
......@@ -78,7 +78,7 @@ namespace dlib
(i.e. rect must not be outside the integral image)
ensures
- Let O denote the image this integral image was generated from.
Then this function returns sum(subm(array_to_matrix(O),rect)).
Then this function returns sum(subm(mat(O),rect)).
That is, this function returns the sum of the pixels in O that
are contained within the given rectangle.
!*/
......
......@@ -554,7 +554,7 @@ namespace dlib
<< "\n\t is_same_object(in_img, out_img): " << is_same_object(in_img, out_img)
);
assign_image(out_img, fliplr(array_to_matrix(in_img)));
assign_image(out_img, fliplr(mat(in_img)));
}
// ----------------------------------------------------------------------------------------
......@@ -575,7 +575,7 @@ namespace dlib
<< "\n\t is_same_object(in_img, out_img): " << is_same_object(in_img, out_img)
);
assign_image(out_img, flipud(array_to_matrix(in_img)));
assign_image(out_img, flipud(mat(in_img)));
}
// ----------------------------------------------------------------------------------------
......
......@@ -177,7 +177,7 @@ namespace dlib
- else
- #label_img[r][c] != 0
- if (img.size() != 0) then
- returns max(array_to_matrix(#label_img))+1
- returns max(mat(#label_img))+1
(i.e. returns a number one greater than the maximum blob id number,
this is the number of blobs found.)
- else
......
......@@ -663,7 +663,7 @@ namespace dlib
strip = strip.intersect(get_rect(img));
if (!strip.is_empty())
{
column_sum[j] = sum(matrix_cast<ptype>(subm(array_to_matrix(img),strip)));
column_sum[j] = sum(matrix_cast<ptype>(subm(mat(img),strip)));
}
++left;
......@@ -679,7 +679,7 @@ namespace dlib
// Now do the bulk of the filtering work.
for (long r = 0; r < img.nr(); ++r)
{
// set to sum at point(-1,r). i.e. should be equal to sum(array_to_matrix(img), translate_rect(rect, point(-1,r)))
// set to sum at point(-1,r). i.e. should be equal to sum(mat(img), translate_rect(rect, point(-1,r)))
// We compute it's value in the next loop.
ptype cur_sum = 0;
......
......@@ -87,7 +87,7 @@ namespace dlib
counts[h[i]] += 1;
}
const unsigned long max_h = index_of_max(vector_to_matrix(counts));
const unsigned long max_h = index_of_max(mat(counts));
temp.clear();
for (unsigned long i = 0; i < v.size(); ++i)
......
......@@ -301,7 +301,7 @@ namespace dlib
}
}
map_assignment[id_i] = index_of_max(vector_to_matrix(b));
map_assignment[id_i] = index_of_max(mat(b));
}
}
......
......@@ -28,12 +28,12 @@ namespace dlib
// can't call max on an empty vector. So put an if here to guard against it.
if (assignment.size() > 0)
{
DLIB_ASSERT(0 <= min(vector_to_matrix(assignment)) && max(vector_to_matrix(assignment)) < cost.nr(),
DLIB_ASSERT(0 <= min(mat(assignment)) && max(mat(assignment)) < cost.nr(),
"\t type assignment_cost(cost,assignment)"
<< "\n\t cost.nr(): " << cost.nr()
<< "\n\t cost.nc(): " << cost.nc()
<< "\n\t min(assignment): " << min(vector_to_matrix(assignment))
<< "\n\t max(assignment): " << max(vector_to_matrix(assignment))
<< "\n\t min(assignment): " << min(mat(assignment))
<< "\n\t max(assignment): " << max(mat(assignment))
);
}
#endif
......
......@@ -193,7 +193,7 @@ namespace dlib
universe_set.top_min = 0;
universe_set.bottom_max = mat.nr()-1;
universe_set.top_max = mat.nr()-1;
universe_set.weight = sum(rowm(array_to_matrix(sum_pos),mat.nr()));
universe_set.weight = sum(rowm(dlib::mat(sum_pos),mat.nr()));
q.push(universe_set);
......@@ -247,7 +247,7 @@ namespace dlib
}
universe_set.weight = sum(rowm(array_to_matrix(sum_pos),mat.nr()));
universe_set.weight = sum(rowm(dlib::mat(sum_pos),mat.nr()));
if (universe_set.weight <= thresh)
break;
......
......@@ -874,7 +874,7 @@ L360:
//goto L720;
}
++nf;
f = calfun(pointer_to_column_vector(&x[1], n));
f = calfun(mat(&x[1], n));
if (ntrits == -1) {
fsave = f;
goto L720;
......@@ -1946,7 +1946,7 @@ L50:
}
/* L60: */
}
f = calfun(pointer_to_column_vector(&x[1],n));
f = calfun(mat(&x[1],n));
fval[nf] = f;
if (nf == 1) {
fbeg = f;
......@@ -2572,7 +2572,7 @@ L260:
/* L290: */
}
++(nf);
f = calfun(pointer_to_column_vector(&w[1],n));
f = calfun(mat(&w[1],n));
fval[kpt] = f;
if (f < fval[kopt]) {
kopt = kpt;
......
......@@ -191,18 +191,18 @@ namespace dlib
)
{
// make sure requires clause is not broken
DLIB_ASSERT(is_vector(vector_to_matrix(list)) && list.size() > 0 &&
DLIB_ASSERT(is_vector(mat(list)) && list.size() > 0 &&
is_col_vector(x) && radius > 0,
"\t double solve_least_squares()"
<< "\n\t invalid arguments were given to this function"
<< "\n\t is_vector(list): " << is_vector(vector_to_matrix(list))
<< "\n\t is_vector(list): " << is_vector(mat(list))
<< "\n\t list.size(): " << list.size()
<< "\n\t is_col_vector(x): " << is_col_vector(x)
<< "\n\t radius: " << radius
);
return find_min_trust_region(stop_strategy,
least_squares_model<T>(f, der, vector_to_matrix(list)),
least_squares_model<T>(f, der, mat(list)),
x,
radius);
}
......@@ -314,18 +314,18 @@ namespace dlib
)
{
// make sure requires clause is not broken
DLIB_ASSERT(is_vector(vector_to_matrix(list)) && list.size() > 0 &&
DLIB_ASSERT(is_vector(mat(list)) && list.size() > 0 &&
is_col_vector(x) && radius > 0,
"\t double solve_least_squares_lm()"
<< "\n\t invalid arguments were given to this function"
<< "\n\t is_vector(list): " << is_vector(vector_to_matrix(list))
<< "\n\t is_vector(list): " << is_vector(mat(list))
<< "\n\t list.size(): " << list.size()
<< "\n\t is_col_vector(x): " << is_col_vector(x)
<< "\n\t radius: " << radius
);
return find_min_trust_region(stop_strategy,
least_squares_lm_model<T>(f, der, vector_to_matrix(list)),
least_squares_lm_model<T>(f, der, mat(list)),
x,
radius);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment