vsip::Vector<T, B> test_ramp(vsip::Vector<T, B> view, T a, T b) { for (vsip::index_type i=0; i<view.size(); ++i) view.put(i, a + T(i)*b); return view; }
void proj_inv( vsip::Matrix<T, Block1> P, vsip::Vector<T, Block2> xy, vsip::Vector<T, Block3> res) { T X = xy.get(0); T Y = xy.get(1); T yD = (P.get(1,0) - P.get(2,0)*Y) * (P.get(0,1) - P.get(2,1)*X) - (P.get(1,1) - P.get(2,1)*Y) * (P.get(0,0) - P.get(2,0)*X); T xD = (P.get(0,0) - P.get(2,0)*X); if (yD == 0) yD = 1e-8; if (xD == 0) xD = 1e-8; T y = ( (P.get(1,0) - P.get(2,0)*Y)*(X - P.get(0,2)) - (P.get(0,0) - P.get(2,0)*X)*(Y - P.get(1,2)) ) / yD; T x = ( (X - P.get(0,2)) - (P.get(0,1) - P.get(2,1)*X)*y ) / xD; res.put(0, x); res.put(1, y); }