23 #ifndef PT_SCENE_DIFF_H
24 #define PT_SCENE_DIFF_H
49 return std::vector<double>(gv.
begin(), gv.
end());
54 std::vector<double> dx_;
76 std::vector<double> dx_;
87 typedef std::vector<double> vec_t;
101 std::copy(g1.
begin(), g1.
end(), g2.begin());
158 return (w_G*r + eps*ej1) / (w_G + eps*eh31);
164 return (w_G*r + eps*ej2) / (w_G + eps*eh32);
185 bool infer_head =
true
192 const Scene_posterior& pt,
193 const std::vector<double>&
ss,
Vector & resize(int new_length, Value_type pad=Value_type(0))
Resize vector, retaining previous values.
Definition: m_vector.cpp:242
size_type size() const
Alias to get_length(). Required to comply with stl Container concept.
Definition: m_vector.h:510
void set_col(int col, const Generic_vector &v)
Replace a column of the matrix with the given vector. "vector" can be any collection of values conver...
Definition: m_matrix.h:1726
Gradient_adapter(const G &grad)
Construct a gradient adapter that wraps 'grad'.
Definition: pt_scene_diff.h:91
Wrapper for generic gradient function.
Definition: pt_scene_diff.h:38
Wraps Scene_gradient to work with ergo::hmc_step.
Definition: pt_scene_diff.h:84
const Scene_adapter & adapter() const
Definition: pt_scene_posterior.h:271
#define eps
Definition: hog.h:32
Functor designed to move 3D points by pixels in image plane.
Definition: pt_scene_diff.h:121
Class that represents a full scene in the PT universe.
Definition: pt_scene.h:40
Scene_hessian(const Scene_posterior &post, const std::vector< double > &dx)
Definition: pt_scene_diff.h:61
Matrix operator()(const Scene &scene) const
Definition: pt_scene_diff.h:65
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
Pixel_move(const Matrix &C)
Construct a pixel-move functor with the given step size and camera.
Definition: pt_scene_diff.h:128
Vector y(double eps) const
Move point in the x-axis of the image.
Definition: pt_scene_diff.h:162
void reset() const
Definition: pt_scene_posterior.h:273
Matrix matrix_inverse(const Matrix &op1)
Invert this matrix.
Definition: m_matrix.cpp:730
void set_point(const Vector &pt)
Set the point to move.
Definition: pt_scene_diff.h:146
function straight edges straight lines(nlines,[x1 x2 y1 y2 theta r])%%To display result ss
Definition: APPgetLargeConnectedEdges.m:20
Matrix hessian_symmetric_ind(const Func &f, const Model &x, const std::vector< double > &dx, const Adapter &adapter)
Computes the Hessian of an "independent" function, evaluated at a point, using finite differences...
Definition: diff_hessian_ind.h:157
Posterior adapter to work with independent gradient computation.
Definition: pt_scene_posterior.h:239
iterator end()
Definition: m_vector.h:557
Scene_gradient(const Scene_posterior &post, const std::vector< double > &dx)
Definition: pt_scene_diff.h:41
iterator begin()
Definition: m_vector.h:537
std::vector< double > trajectory_gradient_step_sizes(const Scene &scene, bool infer_head=true)
Compute the step sizes that equivalent to movement of 1 pixel in image coordinate.
Definition: pt_scene_diff.cpp:128
Posterior distribution of a scene.
Definition: pt_scene_posterior.h:53
void make_max(const Scene &scene, const Scene_posterior &pt, const std::vector< double > &ss, bool infer_head)
Ensures posterior is at max (wrt a given step size).
Definition: pt_scene_diff.cpp:196
Vec_type get_row(int row) const
Return a specified row of this matrix, in the form of a Vector.
Definition: m_matrix.cpp:604
vec_t operator()(const M &m) const
Computes the gradient numerically.
Definition: pt_scene_diff.h:96
Gradient_adapter< G > make_gradient_adapter(const G &grad)
Utility function that makes a gradient adapter.
Definition: pt_scene_diff.h:115
Wrapper for generic hessian function.
Definition: pt_scene_diff.h:58
Vec_type get_col(int col) const
Return a specified column of this matrix, in the form of a Vector.
Definition: m_matrix.cpp:613
std::vector< double > operator()(const Scene &scene) const
Definition: pt_scene_diff.h:45
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
long int dot(const Int_vector &op1, const Int_vector &op2)
Returns dot product of this and op2.
Definition: l_int_vector.h:1532
for m
Definition: APPgetLargeConnectedEdges.m:64
Vector gradient_ind_cfd(const Func &f, const Model &x, const std::vector< double > &dx, const Adapter &adapter)
Computes the gradient of a function, evaluated at a point, using central finite differences.
Definition: diff_gradient.h:200
Vector x(double eps) const
Move point in the x-axis of the image.
Definition: pt_scene_diff.h:156
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
void set_diagonals(const Scene &scene) const
Definition: pt_scene_diff.cpp:40