AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects Version of the Day
AbstractLinAlgPack_VectorAuxiliaryOps.cpp
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #include <assert.h>
00030 
00031 #include "AbstractLinAlgPack_VectorAuxiliaryOps.hpp"
00032 #include "AbstractLinAlgPack_VectorMutable.hpp"
00033 #include "RTOp_ROp_max.h"
00034 #include "RTOp_ROp_max_near_feas_step.h"
00035 #include "RTOp_ROp_max_rel_step.h"
00036 #include "RTOp_ROp_num_bounded.h"
00037 #include "RTOp_ROp_combined_nu_comp_err.h"
00038 #include "RTOp_ROp_comp_err_with_mu.h"
00039 #include "RTOp_ROp_fraction_to_boundary.h"
00040 #include "RTOp_ROp_fraction_to_zero_boundary.h"
00041 #include "RTOp_ROp_log_bound_barrier.h"
00042 #include "RTOp_TOp_correct_multipliers.h"
00043 #include "RTOp_ROp_max_inequ_viol.h"
00044 #include "RTOp_TOp_multiplier_step.h"
00045 #include "RTOp_TOp_force_in_bounds.h"
00046 #include "RTOp_TOp_ele_wise_sqrt.h"
00047 #include "RTOp_TOp_inv_of_difference.h"
00048 #include "RTOp_TOp_max_vec_scalar.h"
00049 #include "RTOp_TOp_max_abs_vec_scalar.h"
00050 #include "RTOpPack_RTOpC.hpp"
00051 #include "Teuchos_TestForException.hpp"
00052 
00053 namespace {
00054 
00055 // log_bound_barrier
00056 static RTOpPack::RTOpC                               log_bound_barrier_op;
00057 static Teuchos::RCP<RTOpPack::ReductTarget>  log_bound_barrier_targ;
00058 // combined_nu_comp_err
00059 static RTOpPack::RTOpC                               combined_nu_comp_err_op;
00060 static Teuchos::RCP<RTOpPack::ReductTarget>  combined_nu_comp_err_targ;
00061 // combined_nu_comp_err_lower
00062 static RTOpPack::RTOpC                               combined_nu_comp_err_lower_op;
00063 static Teuchos::RCP<RTOpPack::ReductTarget>  combined_nu_comp_err_lower_targ;
00064 // combined_nu_comp_err_upper
00065 static RTOpPack::RTOpC                               combined_nu_comp_err_upper_op;
00066 static Teuchos::RCP<RTOpPack::ReductTarget>  combined_nu_comp_err_upper_targ;
00067 // comp_err_with_mu
00068 static RTOpPack::RTOpC                               comp_err_with_mu_op;
00069 static Teuchos::RCP<RTOpPack::ReductTarget>  comp_err_with_mu_targ;
00070 // maximum near feasible step
00071 static RTOpPack::RTOpC                               max_near_feas_step_op;
00072 static Teuchos::RCP<RTOpPack::ReductTarget>  max_near_feas_step_targ;
00073 // fraction to boundary rule
00074 static RTOpPack::RTOpC                               fraction_to_boundary_op;
00075 static Teuchos::RCP<RTOpPack::ReductTarget>  fraction_to_boundary_targ;
00076 // fraction to zero boundary rule
00077 static RTOpPack::RTOpC                               fraction_to_zero_boundary_op;
00078 static Teuchos::RCP<RTOpPack::ReductTarget>  fraction_to_zero_boundary_targ;
00079 // maximum relative step
00080 static RTOpPack::RTOpC                               max_rel_step_op;
00081 static Teuchos::RCP<RTOpPack::ReductTarget>  max_rel_step_targ;
00082 // number of bounded elements
00083 static RTOpPack::RTOpC                               num_bounded_op;
00084 static Teuchos::RCP<RTOpPack::ReductTarget>  num_bounded_targ;
00085 // force in bounds
00086 static RTOpPack::RTOpC                               force_in_bounds_op;
00087 // force in bounds with buffer
00088 static RTOpPack::RTOpC                               force_in_bounds_buffer_op;
00089 // inv_of_difference
00090 static RTOpPack::RTOpC                               inv_of_difference_op;
00091 // correct_multipliers
00092 static RTOpPack::RTOpC                               correct_lower_bound_multipliers_op;
00093 static RTOpPack::RTOpC                               correct_upper_bound_multipliers_op;
00094 // multipliers step
00095 static RTOpPack::RTOpC                               lowerbound_multipliers_step_op;
00096 static RTOpPack::RTOpC                               upperbound_multipliers_step_op;
00097 // element wise square root
00098 static RTOpPack::RTOpC                               ele_wise_sqrt_op;
00099 
00100 // Simple class for an object that will initialize the RTOp_Server.
00101 class init_rtop_server_t {
00102 public:
00103   init_rtop_server_t() {
00104     // Operator and target obj for log_bound_barrier
00105     TEST_FOR_EXCEPT(0!=RTOp_ROp_log_bound_barrier_construct(&log_bound_barrier_op.op()));
00106     log_bound_barrier_targ = log_bound_barrier_op.reduct_obj_create();
00107     // Operator and target obj for combined_nu_comp_err
00108     TEST_FOR_EXCEPT(0!=RTOp_ROp_combined_nu_comp_err_construct(&combined_nu_comp_err_op.op()));
00109     combined_nu_comp_err_targ = combined_nu_comp_err_op.reduct_obj_create();
00110     // Operator and target obj for combined_nu_comp_err_lower
00111     TEST_FOR_EXCEPT(0!=RTOp_ROp_combined_nu_comp_err_one_only_construct(&combined_nu_comp_err_lower_op.op()));
00112     combined_nu_comp_err_lower_targ = combined_nu_comp_err_lower_op.reduct_obj_create();
00113     // Operator and target obj for combined_nu_comp_err_upper
00114     TEST_FOR_EXCEPT(0!=RTOp_ROp_combined_nu_comp_err_one_only_construct(&combined_nu_comp_err_upper_op.op()));
00115     combined_nu_comp_err_upper_targ = combined_nu_comp_err_upper_op.reduct_obj_create();
00116     // Operator and target obj for comp_err_with_mu
00117     TEST_FOR_EXCEPT(0!=RTOp_ROp_comp_err_with_mu_construct(0.0,0.0,&comp_err_with_mu_op.op()));
00118     comp_err_with_mu_targ = comp_err_with_mu_op.reduct_obj_create();
00119     // Operator and target obj for max_near_feas_step
00120     TEST_FOR_EXCEPT(0!=RTOp_ROp_max_near_feas_step_construct(0.0,&max_near_feas_step_op.op()));
00121     max_near_feas_step_targ = max_near_feas_step_op.reduct_obj_create();
00122     // Operator and target obj for max_rel_step
00123     TEST_FOR_EXCEPT(0!=RTOp_ROp_max_rel_step_construct(&max_rel_step_op.op()));
00124     max_rel_step_targ = max_rel_step_op.reduct_obj_create();
00125     // Operator and target obj for fraction to boundary
00126     TEST_FOR_EXCEPT(0!=RTOp_ROp_fraction_to_boundary_construct(0.99,&fraction_to_boundary_op.op()));
00127     fraction_to_boundary_targ = fraction_to_boundary_op.reduct_obj_create();
00128     // Operator and target obj for fraction to zero boundary
00129     TEST_FOR_EXCEPT(0!=RTOp_ROp_fraction_to_zero_boundary_construct(0.99,&fraction_to_zero_boundary_op.op()));
00130     fraction_to_zero_boundary_targ = fraction_to_zero_boundary_op.reduct_obj_create();
00131     // Operator and target obj for num_bounded
00132     TEST_FOR_EXCEPT(0!=RTOp_ROp_num_bounded_construct(0.0,&num_bounded_op.op()));
00133     num_bounded_targ = num_bounded_op.reduct_obj_create();
00134     // Operator force_in_bounds
00135     TEST_FOR_EXCEPT(0!=RTOp_TOp_force_in_bounds_construct( &force_in_bounds_op.op() ));
00136     // Operator force_in_bounds_buffer
00137     TEST_FOR_EXCEPT(0!=RTOp_TOp_force_in_bounds_buffer_construct( 0.01, 0.001, &force_in_bounds_buffer_op.op() ));
00138     // Operator inv_of_difference
00139     TEST_FOR_EXCEPT(0!=RTOp_TOp_inv_of_difference_construct( 1.0,  &inv_of_difference_op.op()));
00140     // correct_lower_bounds_multipliers
00141     TEST_FOR_EXCEPT(0!=RTOp_TOp_Correct_Multipliers_construct( -1e50, 0,  &correct_lower_bound_multipliers_op.op()));
00142     // correct_upper_bounds_multipliers
00143     TEST_FOR_EXCEPT(0!=RTOp_TOp_Correct_Multipliers_construct( 1e50, 1,  &correct_upper_bound_multipliers_op.op()));
00144     // lower_bounds_multipliers step
00145     TEST_FOR_EXCEPT(0!=RTOp_TOp_multiplier_step_construct( 1.0, -1.0,  &lowerbound_multipliers_step_op.op()));
00146     // upper_bounds_multipliers step
00147     TEST_FOR_EXCEPT(0!=RTOp_TOp_multiplier_step_construct( 1.0, 1.0,  &upperbound_multipliers_step_op.op()));
00148     // ele_wise_sqrt
00149     TEST_FOR_EXCEPT(0!=RTOp_TOp_ele_wise_sqrt_construct( &ele_wise_sqrt_op.op()));
00150   }
00151 }; 
00152 
00153 // When the program starts, this object will be created and the RTOp_Server object will
00154 // be initialized before main() gets underway!
00155 init_rtop_server_t  init_rtop_server;
00156 
00157 } // end namespace
00158 
00159 AbstractLinAlgPack::value_type
00160 AbstractLinAlgPack::max_element( const Vector& v )
00161 {
00162   RTOpPack::RTOpC op;
00163   TEST_FOR_EXCEPT(0!=RTOp_ROp_max_construct(&op.op()));
00164   Teuchos::RCP<RTOpPack::ReductTarget> reduct_obj = op.reduct_obj_create();
00165   const Vector* vecs[1] = { &v };
00166   apply_op(op,1,vecs,0,NULL,&*reduct_obj);
00167   return RTOp_ROp_max_val(op(*reduct_obj));
00168 }
00169 
00170 std::pair<AbstractLinAlgPack::value_type,AbstractLinAlgPack::value_type>
00171 AbstractLinAlgPack::max_near_feas_step(
00172   const Vector& x, const Vector& d
00173   ,const Vector& xl, const Vector& xu
00174   ,value_type max_bnd_viol
00175   )
00176 {
00177   const int num_vecs = 4;
00178   const Vector*
00179     vecs[num_vecs] = { &xl, &x, &d, &xu };
00180   TEST_FOR_EXCEPT(0!=RTOp_ROp_max_near_feas_step_set_beta( max_bnd_viol, &max_near_feas_step_op.op() ));
00181   max_near_feas_step_op.reduct_obj_reinit(&*max_near_feas_step_targ);
00182   apply_op(
00183     max_near_feas_step_op, num_vecs, vecs, 0, NULL
00184     ,&*max_near_feas_step_targ );
00185   RTOp_ROp_max_near_feas_step_reduct_obj_t
00186     u = RTOp_ROp_max_near_feas_step_val(max_near_feas_step_op(*max_near_feas_step_targ));;
00187   return std::pair<value_type,value_type>(u.alpha_pos,u.alpha_neg);
00188 }
00189 
00190 AbstractLinAlgPack::value_type
00191 AbstractLinAlgPack::max_rel_step(
00192   const Vector& x, const Vector& d
00193   )
00194 {
00195   const int num_vecs = 2;
00196   const Vector*
00197     vecs[num_vecs] = { &x, &d };
00198   max_rel_step_op.reduct_obj_reinit(&*max_rel_step_targ);
00199   apply_op(
00200     max_rel_step_op, num_vecs, vecs, 0, NULL
00201     ,&*max_rel_step_targ );
00202   return RTOp_ROp_max_rel_step_val(max_rel_step_op(*max_rel_step_targ));
00203 }
00204 
00205 
00206 AbstractLinAlgPack::value_type
00207 AbstractLinAlgPack::fraction_to_boundary(
00208   const value_type tau,
00209   const Vector& x,
00210   const Vector& d,
00211   const Vector& xl,
00212   const Vector& xu
00213   )
00214 {
00215   TEST_FOR_EXCEPT(0!=RTOp_ROp_fraction_to_boundary_init( tau, &fraction_to_boundary_op.op() ));
00216   fraction_to_boundary_op.reduct_obj_reinit(&*fraction_to_boundary_targ);
00217   const int num_vecs = 4;
00218   const Vector*
00219     vecs[num_vecs] = { &x, &d, &xl, &xu };
00220   apply_op(
00221     fraction_to_boundary_op, num_vecs, vecs, 0, NULL
00222     ,&*fraction_to_boundary_targ );
00223   return RTOp_ROp_fraction_to_boundary_val(fraction_to_boundary_op(*fraction_to_boundary_targ));
00224 }
00225 
00226 AbstractLinAlgPack::value_type
00227 AbstractLinAlgPack::fraction_to_zero_boundary(
00228   const value_type tau,
00229   const Vector& x,
00230   const Vector& d
00231   )
00232 {
00233   TEST_FOR_EXCEPT(0!=RTOp_ROp_fraction_to_zero_boundary_init( tau, &fraction_to_zero_boundary_op.op() ));
00234   fraction_to_zero_boundary_op.reduct_obj_reinit(&*fraction_to_zero_boundary_targ);
00235   const int num_vecs = 2;
00236   const Vector*
00237     vecs[num_vecs] = { &x, &d };
00238   apply_op(
00239     fraction_to_zero_boundary_op, num_vecs, vecs, 0, NULL
00240     ,&*fraction_to_zero_boundary_targ );
00241   return RTOp_ROp_fraction_to_zero_boundary_val(fraction_to_zero_boundary_op(*fraction_to_zero_boundary_targ));
00242 }
00243 
00244 AbstractLinAlgPack::size_type
00245 AbstractLinAlgPack:: num_bounded(
00246   const Vector& xl, const Vector& xu
00247   ,value_type inf_bound
00248   )
00249 {
00250   TEST_FOR_EXCEPT(0!=RTOp_ROp_num_bounded_set_inf_bnd( inf_bound, &num_bounded_op.op() ));
00251   num_bounded_op.reduct_obj_reinit(&*num_bounded_targ);
00252   const int num_vecs = 2;
00253   const Vector*
00254     vecs[num_vecs] = { &xl, &xu };
00255   apply_op(
00256     num_bounded_op, num_vecs, vecs, 0, NULL
00257     ,&*num_bounded_targ );
00258   return RTOp_ROp_num_bounded_val(num_bounded_op(*num_bounded_targ));
00259 }
00260 
00261 AbstractLinAlgPack::value_type
00262 AbstractLinAlgPack::log_bound_barrier(
00263   const Vector    &x
00264   ,const Vector   &xl
00265   ,const Vector   &xu
00266   )
00267 {
00268   log_bound_barrier_op.reduct_obj_reinit(&*log_bound_barrier_targ);
00269   const int num_vecs = 3;
00270   const Vector*
00271     vecs[num_vecs] = { &x, &xl, &xu };
00272   apply_op(
00273     log_bound_barrier_op, num_vecs, vecs, 0, NULL
00274     ,&*log_bound_barrier_targ
00275     );
00276 
00277   return RTOp_ROp_log_bound_barrier_val(log_bound_barrier_op(*log_bound_barrier_targ));
00278 }
00279 
00280 AbstractLinAlgPack::value_type
00281 AbstractLinAlgPack::combined_nu_comp_err(
00282   const Vector     &v
00283   ,const Vector    &x
00284   ,const Vector   &xl
00285   ,const Vector   &xu
00286   )
00287 {
00288   combined_nu_comp_err_op.reduct_obj_reinit(&*combined_nu_comp_err_targ);
00289   const int num_vecs = 4;
00290   const Vector*
00291     vecs[num_vecs] = {&v, &x, &xl, &xu };
00292   apply_op(
00293     combined_nu_comp_err_op, num_vecs, vecs, 0, NULL
00294     ,&*combined_nu_comp_err_targ
00295     );
00296   return RTOp_ROp_combined_nu_comp_err_val(combined_nu_comp_err_op(*combined_nu_comp_err_targ));
00297 }
00298 
00299 AbstractLinAlgPack::value_type
00300 AbstractLinAlgPack::combined_nu_comp_err_lower(
00301   const Vector    &v
00302   ,const Vector   &x
00303   ,const Vector   &xl
00304   )
00305 {
00306   combined_nu_comp_err_lower_op.reduct_obj_reinit(&*combined_nu_comp_err_lower_targ);
00307   const int num_vecs = 3;
00308   const Vector*
00309     vecs[num_vecs] = {&v, &xl, &x};
00310   apply_op(
00311     combined_nu_comp_err_lower_op, num_vecs, vecs, 0, NULL
00312     ,&*combined_nu_comp_err_lower_targ
00313     );
00314   return RTOp_ROp_combined_nu_comp_err_one_only_val(combined_nu_comp_err_lower_op(*combined_nu_comp_err_lower_targ));
00315 }
00316 
00317 
00318 AbstractLinAlgPack::value_type
00319 AbstractLinAlgPack::combined_nu_comp_err_upper(
00320   const Vector    &v
00321   ,const Vector   &x
00322   ,const Vector   &xu
00323   )
00324 {
00325   combined_nu_comp_err_upper_op.reduct_obj_reinit(&*combined_nu_comp_err_upper_targ);
00326   const int num_vecs = 3;
00327   const Vector*
00328     vecs[num_vecs] = {&v, &xu, &x};
00329   apply_op(
00330     combined_nu_comp_err_upper_op, num_vecs, vecs, 0, NULL
00331     ,&*combined_nu_comp_err_upper_targ
00332     );
00333   return RTOp_ROp_combined_nu_comp_err_one_only_val(combined_nu_comp_err_upper_op(*combined_nu_comp_err_upper_targ));
00334 }
00335 
00336 AbstractLinAlgPack::value_type
00337 AbstractLinAlgPack::IP_comp_err_with_mu(
00338   const value_type mu
00339   ,const value_type inf_bound
00340   ,const Vector &x
00341   ,const Vector &xl
00342   ,const Vector &xu
00343   ,const Vector &vl
00344   ,const Vector &vu
00345   )
00346 {
00347   TEST_FOR_EXCEPT(0!=RTOp_ROp_comp_err_with_mu_init(mu, inf_bound, &comp_err_with_mu_op.op()));
00348   comp_err_with_mu_op.reduct_obj_reinit(&*comp_err_with_mu_targ);
00349   const int num_vecs = 5;
00350   const Vector*
00351     vecs[num_vecs] = {&x, &xl, &xu, &vl, &vu};
00352   apply_op(
00353     comp_err_with_mu_op, num_vecs, vecs, 0, NULL
00354     ,&*comp_err_with_mu_targ
00355     );
00356   return RTOp_ROp_comp_err_with_mu_val(comp_err_with_mu_op(*comp_err_with_mu_targ));
00357 }
00358 
00359 bool AbstractLinAlgPack::max_inequ_viol(
00360   const AbstractLinAlgPack::Vector   &v
00361   ,const AbstractLinAlgPack::Vector  &vL
00362   ,const AbstractLinAlgPack::Vector  &vU
00363   ,AbstractLinAlgPack::size_type     *max_viol_i
00364   ,AbstractLinAlgPack::value_type    *max_viol
00365   ,AbstractLinAlgPack::value_type    *v_i
00366   ,int                               *bnd_type
00367   ,AbstractLinAlgPack::value_type    *vLU_i
00368   )
00369 {
00370   RTOpPack::RTOpC op;
00371   TEST_FOR_EXCEPT(0!=RTOp_ROp_max_inequ_viol_construct(&op.op()));
00372   Teuchos::RCP<RTOpPack::ReductTarget> reduct_obj = op.reduct_obj_create();
00373   const int num_vecs = 3;
00374   const Vector*
00375     vecs[num_vecs] = { &v, &vL, &vU };
00376   apply_op(
00377     op, num_vecs, vecs, 0, NULL
00378     ,&*reduct_obj
00379     );
00380   const RTOp_ROp_max_inequ_viol_reduct_obj_t
00381     ro = RTOp_ROp_max_inequ_viol_val(op(*reduct_obj));
00382   *max_viol_i = ro.max_viol_i;
00383   *max_viol   = ro.max_viol;
00384   *v_i        = ro.v_i;
00385   *bnd_type   = ro.bnd_type;
00386   *vLU_i      = ro.vLU_i;
00387   return *max_viol_i > 0.0;
00388 }
00389 
00390 void AbstractLinAlgPack::force_in_bounds(
00391   const Vector& xl, const Vector& xu
00392   ,VectorMutable* x
00393   )
00394 {
00395 #ifdef TEUCHOS_DEBUG
00396   TEST_FOR_EXCEPTION(x==NULL,std::logic_error,"force_in_bounds(...), Error");
00397 #endif
00398   const Vector*  vecs[2]      = { &xl, &xu };
00399   VectorMutable* targ_vecs[1] = { x };
00400   apply_op(force_in_bounds_op,2,vecs,1,targ_vecs,NULL);
00401 }
00402 
00403 
00404 void AbstractLinAlgPack::force_in_bounds_buffer(
00405   const value_type rel_push,
00406   const value_type abs_push,
00407   const Vector& xl, 
00408   const Vector& xu,
00409   VectorMutable* x
00410   )
00411 {
00412   TEST_FOR_EXCEPT(0!=RTOp_TOp_force_in_bounds_buffer_init( rel_push, abs_push, &force_in_bounds_buffer_op.op()));
00413   const Vector*  vecs[2]      = { &xl, &xu };
00414   VectorMutable* targ_vecs[1] = { x };
00415   apply_op(force_in_bounds_buffer_op,2,vecs,1,targ_vecs,NULL);
00416 }
00417 
00418 
00419 void AbstractLinAlgPack::inv_of_difference(
00420   const value_type      alpha
00421   ,const Vector   &v0
00422   ,const Vector   &v1
00423   ,VectorMutable  *z
00424   )
00425 {
00426   TEST_FOR_EXCEPT(0!=RTOp_TOp_inv_of_difference_init( alpha, &inv_of_difference_op.op()));
00427   const Vector*  vecs[2]      = { &v0, &v1 };
00428   VectorMutable* targ_vecs[1] = { z };
00429   apply_op(inv_of_difference_op,2,vecs,1,targ_vecs,NULL);
00430 }
00431 
00432 void AbstractLinAlgPack::correct_lower_bound_multipliers(
00433   const Vector       &xl
00434   ,const value_type  inf_bound_limit
00435   ,VectorMutable     *vl
00436   )
00437 {
00438   TEST_FOR_EXCEPT(0!=RTOp_TOp_Correct_Multipliers_init( inf_bound_limit, 0, &correct_lower_bound_multipliers_op.op()))
00439   const Vector*  vecs[1]      = { &xl };
00440   VectorMutable* targ_vecs[1] = { vl };
00441   apply_op(correct_lower_bound_multipliers_op,1,vecs,1,targ_vecs,NULL);
00442 }
00443 
00444 void AbstractLinAlgPack::correct_upper_bound_multipliers(
00445   const Vector       &xu
00446   ,const value_type  inf_bound_limit
00447   ,VectorMutable     *vu
00448   )
00449 {
00450   TEST_FOR_EXCEPT(0!=RTOp_TOp_Correct_Multipliers_init( inf_bound_limit, 1, &correct_upper_bound_multipliers_op.op()));
00451   const Vector*  vecs[1]      = { &xu };
00452   VectorMutable* targ_vecs[1] = { vu };
00453   apply_op(correct_upper_bound_multipliers_op,1,vecs,1,targ_vecs,NULL);
00454 }
00455 
00456 void AbstractLinAlgPack::lowerbound_multipliers_step(
00457   const value_type mu,
00458   const Vector& invXl,
00459   const Vector& vl,
00460   const Vector& d_k,
00461   VectorMutable* dvl_k
00462   )
00463 {
00464   TEST_FOR_EXCEPT(0!=RTOp_TOp_multiplier_step_init(mu, -1.0, &lowerbound_multipliers_step_op.op()));
00465   const Vector*  vecs[]      = { &invXl, &vl, &d_k };
00466   VectorMutable* targ_vecs[] = { dvl_k };
00467   apply_op(lowerbound_multipliers_step_op,3,vecs,1,targ_vecs,NULL);
00468 }
00469 
00470 void AbstractLinAlgPack::upperbound_multipliers_step(
00471   const value_type mu,
00472   const Vector& invXu,
00473   const Vector& vu,
00474   const Vector& d_k,
00475   VectorMutable* dvu_k
00476   )
00477 {
00478    TEST_FOR_EXCEPT(0!=RTOp_TOp_multiplier_step_init(mu, 1.0, &upperbound_multipliers_step_op.op()));
00479   const Vector*  vecs[] = { &invXu, &vu, &d_k };
00480   VectorMutable* targ_vecs[] = { dvu_k };
00481   apply_op(upperbound_multipliers_step_op,3,vecs,1,targ_vecs,NULL);
00482 }
00483 
00484 void AbstractLinAlgPack::ele_wise_sqrt(
00485   VectorMutable* z
00486   )
00487 {
00488   VectorMutable* targ_vecs[] = { z };
00489   apply_op(ele_wise_sqrt_op,0,NULL,1,targ_vecs,NULL);  
00490 }
00491 
00492 void AbstractLinAlgPack::max_vec_scalar(
00493   value_type        min_ele
00494   ,VectorMutable    *y
00495   )
00496 {
00497   RTOpPack::RTOpC op;
00498   TEST_FOR_EXCEPT(0!=RTOp_TOp_max_vec_scalar_construct(min_ele,&op.op()));
00499   VectorMutable* targ_vecs[] = { y };
00500   apply_op(op,0,NULL,1,targ_vecs,NULL);
00501 }
00502 
00503 void AbstractLinAlgPack::max_abs_vec_scalar(
00504   value_type        min_ele
00505   ,VectorMutable    *y
00506   )
00507 {
00508   RTOpPack::RTOpC op;
00509   TEST_FOR_EXCEPT(0!=RTOp_TOp_max_abs_vec_scalar_construct(min_ele,&op.op()));
00510   VectorMutable* targ_vecs[] = { y };
00511   apply_op(op,0,NULL,1,targ_vecs,NULL);
00512 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends