From 48edb52e2e23936f577ecfb84a38b3d55c2f6877 Mon Sep 17 00:00:00 2001 From: Dongryeol Lee Date: Mon, 4 Feb 2008 21:32:56 +0000 Subject: [PATCH] more structuring --- .../dongryel/regression/local_linear_krylov.h | 33 +++++++++++-------- .../local_linear_krylov_solver_impl.h | 5 ++- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/fastlib2/contrib/dongryel/regression/local_linear_krylov.h b/fastlib2/contrib/dongryel/regression/local_linear_krylov.h index c9c0ae84ac..032accf5a4 100644 --- a/fastlib2/contrib/dongryel/regression/local_linear_krylov.h +++ b/fastlib2/contrib/dongryel/regression/local_linear_krylov.h @@ -192,21 +192,26 @@ class LocalLinearKrylov { */ Matrix right_hand_sides_u_; - /** @brief The coordinatewise lower bound on the solution vector of - * (B^T W(q) B)^+ (B^T W(q) Y) for each query point. + /** @brief The coordinate-wise lower bound on the temporary vector + * generated during the iterative method. */ - Matrix solution_vectors_l_; + Matrix krylov_tmp_vectors_l_; + + /** @brief The estimate on the temporary vector generated during the + * iterative method. + */ + Matrix krylov_tmp_vectors_e_; + + /** @brief The coordinate-wise upper bound on the temporary vector + * generated during the iterative method. + */ + Matrix krylov_tmp_vectors_u_; /** @brief The estimate of the solution vector of (B^T W(q) B)^+ * (B^T W(q) Y) for each query point. */ Matrix solution_vectors_e_; - /** @brief The coordinatewise upper bound on the solution vector of - * (B^T W(q) B)^+ (B^T W(q) Y) for each query point - */ - Matrix solution_vectors_u_; - /** @brief The final regression estimate for each query point. */ Vector regression_estimates_; @@ -350,9 +355,8 @@ class LocalLinearKrylov { // Make aliases of the current query point and its associated // solution vector. - Vector query_pt, query_pt_solution; - qset_.MakeColumnVector(i, &query_pt); - solution_vectors_e_.MakeColumnVector(i, &query_pt_solution); + const double *query_pt = qset_.GetColumnPtr(i); + const double *query_pt_solution = solution_vectors_e_.GetColumnPtr(i); // Set the first component of the dot-product. regression_estimates_[i] = query_pt_solution[0]; @@ -470,9 +474,12 @@ class LocalLinearKrylov { right_hand_sides_l_.Init(row_length_, qset_.n_cols()); right_hand_sides_e_.Init(row_length_, qset_.n_cols()); right_hand_sides_u_.Init(row_length_, qset_.n_cols()); - solution_vectors_l_.Init(row_length_, qset_.n_cols()); + solution_vectors_e_.Init(row_length_, qset_.n_cols()); - solution_vectors_u_.Init(row_length_, qset_.n_cols()); + krylov_tmp_vectors_l_.Init(row_length_, qset_.n_cols()); + krylov_tmp_vectors_e_.Init(row_length_, qset_.n_cols()); + krylov_tmp_vectors_u_.Init(row_length_, qset_.n_cols()); + regression_estimates_.Init(qset_.n_cols()); new_right_hand_sides_l_.Init(row_length_); right_hand_sides_l_change_.Init(row_length_); diff --git a/fastlib2/contrib/dongryel/regression/local_linear_krylov_solver_impl.h b/fastlib2/contrib/dongryel/regression/local_linear_krylov_solver_impl.h index 8a1dac0d68..2f08809e5c 100644 --- a/fastlib2/contrib/dongryel/regression/local_linear_krylov_solver_impl.h +++ b/fastlib2/contrib/dongryel/regression/local_linear_krylov_solver_impl.h @@ -62,7 +62,10 @@ void LocalLinearKrylov::InitializeQueryTreeSolver_(Tree *qnode) { template void LocalLinearKrylov::SolveLeastSquaresByKrylov_() { - + + // Initialize the initial solutions to zero vectors. + solution_vectors_e_.SetZero(); + // Initialize the query tree bounds. InitializeQueryTreeSolver_(qroot_);