CSparseCholeskyInternal::CSparseCholeskyInternal(const Sparsity& sparsity, int nrhs) : LinearSolverInternal(sparsity, nrhs) { L_ = 0; S_ = 0; casadi_assert_message(sparsity.issymmetric(), "CSparseCholeskyInternal: supplied sparsity must be symmetric, got " << sparsity.dimString() << "."); }
// Constructor SdpSolverInternal::SdpSolverInternal(const std::vector<Sparsity> &st) : st_(st) { addOption("calc_p", OT_BOOLEAN, true, "Indicate if the P-part of primal solution should be allocated and calculated. " "You may want to avoid calculating this variable for problems with n large, " "as is always dense (m x m)."); addOption("calc_dual", OT_BOOLEAN, true, "Indicate if dual should be allocated and calculated. " "You may want to avoid calculating this variable for problems with n large, " "as is always dense (m x m)."); addOption("print_problem", OT_BOOLEAN, false, "Print out problem statement for debugging."); casadi_assert_message(st_.size()==SDP_STRUCT_NUM, "Problem structure mismatch"); const Sparsity& A = st_[SDP_STRUCT_A]; const Sparsity& G = st_[SDP_STRUCT_G]; const Sparsity& F = st_[SDP_STRUCT_F]; casadi_assert_message(G==G.transpose(), "SdpSolverInternal: Supplied G sparsity must " "symmetric but got " << G.dimString()); m_ = G.size1(); nc_ = A.size1(); n_ = A.size2(); casadi_assert_message(F.size1()==m_, "SdpSolverInternal: Supplied F sparsity: number of rows (" << F.size1() << ") must match m (" << m_ << ")"); casadi_assert_message(F.size2()%n_==0, "SdpSolverInternal: Supplied F sparsity: " "number of columns (" << F.size2() << ") must be an integer multiple of n (" << n_ << "), but got remainder " << F.size2()%n_); // Input arguments setNumInputs(SDP_SOLVER_NUM_IN); input(SDP_SOLVER_G) = DMatrix(G, 0); input(SDP_SOLVER_F) = DMatrix(F, 0); input(SDP_SOLVER_A) = DMatrix(A, 0); input(SDP_SOLVER_C) = DMatrix::zeros(n_); input(SDP_SOLVER_LBX) = -DMatrix::inf(n_); input(SDP_SOLVER_UBX) = DMatrix::inf(n_); input(SDP_SOLVER_LBA) = -DMatrix::inf(nc_); input(SDP_SOLVER_UBA) = DMatrix::inf(nc_); for (int i=0;i<n_;i++) { Sparsity s = input(SDP_SOLVER_F)(ALL, Slice(i*m_, (i+1)*m_)).sparsity(); casadi_assert_message(s==s.transpose(), "SdpSolverInternal: Each supplied Fi must be symmetric. " "But got " << s.dimString() << " for i = " << i << "."); } input_.scheme = SCHEME_SDPInput; output_.scheme = SCHEME_SDPOutput; }