public override Band_Data Calculate_Newton_Step(SpinResolved_Data rho_prime, Band_Data g_phi) { DoubleTriDiagMatrix lap_mat = -1.0 * Generate_Laplacian(exp.Layers); Band_Data rho_prime_spin_summed = rho_prime.Spin_Summed_Data; // check that lap_mat and rho_prime have the same dimension if (rho_prime_spin_summed.Length != lap_mat.Rows) { throw new Exception("Error - the Laplacian generated by pois_solv has a different order to rho_prime!"); } for (int i = 0; i < rho_prime_spin_summed.Length; i++) { lap_mat[i, i] -= rho_prime_spin_summed.vec[i]; } DoubleTriDiagFact lu_newt_step = new DoubleTriDiagFact(lap_mat); // calculate newton step and its laplacian Band_Data result = new Band_Data(lu_newt_step.Solve(-1.0 * g_phi.vec)); result.Laplacian = Calculate_Phi_Laplacian(result); return(result); }
public OneD_PoissonSolver(Experiment exp, bool using_external_code, Dictionary<string, object> input) : base(using_external_code) { this.exp = exp; // generate Laplacian matrix (spin-resolved) if (!using_external_code) { laplacian = Generate_Laplacian(exp.Layers); lu_fact = new DoubleTriDiagFact(laplacian); } }
public OneD_PoissonSolver(Experiment exp, bool using_external_code, Dictionary <string, object> input) : base(using_external_code) { this.exp = exp; // generate Laplacian matrix (spin-resolved) if (!using_external_code) { laplacian = Generate_Laplacian(exp.Layers); lu_fact = new DoubleTriDiagFact(laplacian); } }
public override Band_Data Calculate_Newton_Step(SpinResolved_Data rho_prime, Band_Data g_phi) { DoubleTriDiagMatrix lap_mat = -1.0 * Generate_Laplacian(exp.Layers); Band_Data rho_prime_spin_summed = rho_prime.Spin_Summed_Data; // check that lap_mat and rho_prime have the same dimension if (rho_prime_spin_summed.Length != lap_mat.Rows) throw new Exception("Error - the Laplacian generated by pois_solv has a different order to rho_prime!"); for (int i = 0; i < rho_prime_spin_summed.Length; i++) lap_mat[i, i] -= rho_prime_spin_summed.vec[i]; DoubleTriDiagFact lu_newt_step = new DoubleTriDiagFact(lap_mat); // calculate newton step and its laplacian Band_Data result = new Band_Data(lu_newt_step.Solve(-1.0 * g_phi.vec)); result.Laplacian = Calculate_Phi_Laplacian(result); return result; }