/**
	 \brief add a projection to the solver.
	 \param proj the new projection to add.
	 */
	void add_projection(vec_d proj)
	{
		if (this->num_projections==0) {
			this->pi = (vec_d *) br_malloc(sizeof(vec_d));
		}
		else {
			this->pi = (vec_d *) br_realloc(pi,(this->num_projections+1) *sizeof(vec_d));
		}
		
		init_vec_d(pi[num_projections],0);
		vec_cp_d(pi[num_projections], proj);
		
		num_projections++;
	}
Ejemplo n.º 2
0
	void copy(const nullspacejac_eval_data_d & other)
	{
		
		clear();
		reset_counters();
		
		
		
		
		if (other.num_additional_linears>0) {
			
			
			this->additional_linears_terminal						= (vec_d *) br_malloc(other.num_additional_linears*sizeof(vec_d));
			this->additional_linears_starting						= (vec_d *) br_malloc(other.num_additional_linears*sizeof(vec_d));
			
			for (int ii=0; ii<other.num_additional_linears; ii++) {
				vec_cp_d(this->additional_linears_terminal[ii],						other.additional_linears_terminal[ii]);
				
				vec_cp_d(this->additional_linears_starting[ii],						other.additional_linears_starting[ii]);
			}
		}
		else {} // other.num_additional_linears == 0
		
		this->num_additional_linears = other.num_additional_linears;
		
		
		
		
		if (other.num_jac_equations) {
			this->starting_linears = (vec_d **) br_malloc(other.num_jac_equations*sizeof(vec_d *));
			
			for (int ii=0; ii<other.num_jac_equations; ii++) {
				this->starting_linears[ii] = (vec_d *) br_malloc(other.max_degree*sizeof(vec_d ));
				for (int jj=0; jj<other.max_degree; jj++) {
					init_vec_d(this->starting_linears[ii][jj],0);
					vec_cp_d(this->starting_linears[ii][jj],other.starting_linears[ii][jj]);
				}
			}
		}
		else{}
		
		
		
		this->num_jac_equations = other.num_jac_equations;
		this->max_degree = other.max_degree;
		
		
		if (other.num_v_linears) {
			this->v_linears = (vec_d *) br_malloc(other.num_v_linears*sizeof(vec_d));
			for (int ii=0; ii<num_v_linears; ii++) {
				init_vec_d(this->v_linears[ii],0);
				vec_cp_d(this->v_linears[ii],other.v_linears[ii]);
			}
		}
		else{}
		
		vec_cp_d(this->v_patch, other.v_patch);
		
		mat_cp_d(this->jac_with_proj, other.jac_with_proj);
		
		
		
		
		if (other.num_projections>0) {
			this->target_projection = (vec_d *) br_malloc(other.num_projections*sizeof(vec_d));
			
			for (int ii=0; ii<num_projections; ii++) {
				init_vec_d(this->target_projection[ii],0);
				vec_cp_d(this->target_projection[ii],other.target_projection[ii]);
			}
		}
		else{}
		
		
		this->num_jac_equations = other.num_jac_equations;
		this->target_dim = other.target_dim;   // r			the dimension of the real set we are looking for
		this->ambient_dim = other.ambient_dim;  // k			the dimension of the complex component we are looking IN.
		this->target_crit_codim = other.target_crit_codim;    // \ell.  must be at least one (1), and at most target_dim (r).
		
		this->num_v_vars = other.num_v_vars;  // N   number of variables in original problem statement (including homogenizing variables)
		this->num_natural_vars = other.num_natural_vars;  // N-k+\ell
		this->num_synth_vars = other.num_synth_vars;
		
		this->max_degree = other.max_degree;						// the max degree of differentiated (randomized) functions
		
		
		this->num_projections = other.num_projections;
		this->num_v_linears = other.num_v_linears;
		this->num_additional_linears = other.num_additional_linears;
		
		
		
	} // re: copy