Exemplo n.º 1
0
  ScaledMatrixSpace::ScaledMatrixSpace(
    const SmartPtr<const Vector>& row_scaling,
    bool row_scaling_reciprocal,
    const SmartPtr<const MatrixSpace>& unscaled_matrix_space,
    const SmartPtr<const Vector>& column_scaling,
    bool column_scaling_reciprocal)
      :
      MatrixSpace(unscaled_matrix_space->NRows(),
                  unscaled_matrix_space->NCols()),
      unscaled_matrix_space_(unscaled_matrix_space)
  {
    if (IsValid(row_scaling)) {
      row_scaling_ = row_scaling->MakeNewCopy();
      if (row_scaling_reciprocal) {
        row_scaling_->ElementWiseReciprocal();
      }
    }
    else {
      row_scaling_ = NULL;
    }

    if (IsValid(column_scaling)) {
      column_scaling_ = column_scaling->MakeNewCopy();
      if (column_scaling_reciprocal) {
        column_scaling_->ElementWiseReciprocal();
      }
    }
    else {
      column_scaling_ = NULL;
    }
  }
 /** Constructor, given the number of row and columns blocks, as
  *  well as the totel number of rows and columns.
  */
 SymScaledMatrixSpace(const SmartPtr<const Vector>& row_col_scaling,
                      bool row_col_scaling_reciprocal,
                      const SmartPtr<const SymMatrixSpace>& unscaled_matrix_space)
     :
     SymMatrixSpace(unscaled_matrix_space->Dim()),
     unscaled_matrix_space_(unscaled_matrix_space)
 {
   scaling_ = row_col_scaling->MakeNewCopy();
   if (row_col_scaling_reciprocal) {
     scaling_->ElementWiseReciprocal();
   }
 }
Exemplo n.º 3
0
 SmartPtr<Vector> StandardScalingBase::unapply_vector_scaling_x_NonConst(
   const SmartPtr<const Vector>& v)
 {
   DBG_START_METH("StandardScalingBase::unapply_vector_scaling_x_NonConst",
                  dbg_verbosity);
   SmartPtr<Vector> unscaled_x = v->MakeNewCopy();
   if (IsValid(dx_)) {
     unscaled_x->ElementWiseDivide(*dx_);
   }
   else {
     DBG_PRINT((1, "Creating copy in unapply_vector_scaling_x_NonConst!"));
   }
   return unscaled_x;
 }
Exemplo n.º 4
0
 SmartPtr<Vector> StandardScalingBase::unapply_vector_scaling_d_NonConst(
   const SmartPtr<const Vector>& v)
 {
   DBG_START_METH("StandardScalingBase::unapply_vector_scaling_d_NonConst",
                  dbg_verbosity);
   SmartPtr<Vector> scaled_d = v->MakeNewCopy();
   if (IsValid(scaled_jac_d_space_) &&
       IsValid(scaled_jac_d_space_->RowScaling())) {
     scaled_d->ElementWiseDivide(*scaled_jac_d_space_->RowScaling());
   }
   else {
     DBG_PRINT((1,"Creating copy in unapply_vector_scaling_d_NonConst!"));
   }
   return scaled_d;
 }