Included the measure for the inner products everywhere.
This commit is contained in:
parent
f42c5ab0de
commit
cf5d3fd209
@ -147,7 +147,7 @@ function [psi] = runGradientDescent(this,psi,Params,Transf,VDk,V,Observ)
|
|||||||
theta = compute_optimal_theta(p, muchem, psi, Params, Transf, VDk, V);
|
theta = compute_optimal_theta(p, muchem, psi, Params, Transf, VDk, V);
|
||||||
|
|
||||||
% Update solution
|
% Update solution
|
||||||
gamma = 1 / sqrt(sum(abs(p(:)).^2));
|
gamma = 1 / sqrt(sum(abs(p(:)).^2) * Transf.dx * Transf.dy * Transf.dz);
|
||||||
psi = (cos(theta).*psi) + (gamma*sin(theta).*p);
|
psi = (cos(theta).*psi) + (gamma*sin(theta).*p);
|
||||||
% Normalize psi
|
% Normalize psi
|
||||||
Norm = sum(abs(psi(:)).^2) * Transf.dx * Transf.dy * Transf.dz;
|
Norm = sum(abs(psi(:)).^2) * Transf.dx * Transf.dy * Transf.dz;
|
||||||
@ -261,8 +261,8 @@ function theta = compute_optimal_theta(p, muchem, psi, Params, Transf, VDk, V)
|
|||||||
Hpsi = compute_gradient(psi, Params, Transf, VDk, V);
|
Hpsi = compute_gradient(psi, Params, Transf, VDk, V);
|
||||||
Hp = compute_gradient(p, Params, Transf, VDk, V);
|
Hp = compute_gradient(p, Params, Transf, VDk, V);
|
||||||
g = compute_g(psi, p, Params, VDk);
|
g = compute_g(psi, p, Params, VDk);
|
||||||
gamma = 1 / sqrt(sum(abs(p(:)).^2));
|
gamma = 1 / sqrt(sum(abs(p(:)).^2) * Transf.dx * Transf.dy * Transf.dz);
|
||||||
numerator = real(p(:)' * Hpsi(:) * Transf.dx * Transf.dy * Transf.dz)/gamma;
|
numerator = gamma * real(p(:)' * Hpsi(:) * Transf.dx * Transf.dy * Transf.dz);
|
||||||
denominator = muchem - (gamma^2 * (real(p(:)' * Hp(:) * Transf.dx * Transf.dy * Transf.dz) + real(g(:)' * p(:) * Transf.dx * Transf.dy * Transf.dz)));
|
denominator = muchem - (gamma^2 * (real(p(:)' * Hp(:) * Transf.dx * Transf.dy * Transf.dz) + real(g(:)' * p(:) * Transf.dx * Transf.dy * Transf.dz)));
|
||||||
|
|
||||||
theta = numerator / denominator;
|
theta = numerator / denominator;
|
||||||
|
Loading…
Reference in New Issue
Block a user