1 | function [H_new zero range eigvec u]=update_hyperstate(H_old,zero, range, eigvec, u,n_grid,sigma,H_full)
|
---|
2 |
|
---|
3 | next_u=zeros(1,size(H_old,2));
|
---|
4 |
|
---|
5 | step=[1 n_grid n_grid^2];
|
---|
6 | rozsah_min=[1;0;0];
|
---|
7 | rozsah_max=[n_grid; n_grid-1; n_grid-1];
|
---|
8 | stav1=zeros(3,1);
|
---|
9 |
|
---|
10 | H_new=generate_trajectories(H_old,u,sigma);
|
---|
11 |
|
---|
12 | for i=2:size(H_new,1)
|
---|
13 | pom(:,:)=H_new(i,:,:);
|
---|
14 | [H_new(i,:,:) next_zero next_range next_eigvec]=make_box3(pom,n_grid); %rovnomerne rozmisti body v zasazenem regionu
|
---|
15 |
|
---|
16 |
|
---|
17 | if (H_full) %kopirovani stareho u* do H_new
|
---|
18 | for j=1:size(H_new,2)
|
---|
19 | stav(1)=H_new(i,j,1)-zero(i,1);
|
---|
20 | stav(2)=H_new(i,j,2)-zero(i,2);
|
---|
21 | stav(3)=H_new(i,j,3)-zero(i,3);
|
---|
22 | for p=1:3
|
---|
23 | stav1(p)=(stav(1)*eigvec(i,1,p)+stav(2)*eigvec(i,2,p)+stav(3)*eigvec(i,3,p))*range(i,p);
|
---|
24 | end
|
---|
25 | index=step*max(min(round(stav1*(n_grid-1))+rozsah_min,rozsah_max),rozsah_min);
|
---|
26 |
|
---|
27 | next_u(j)=u(i,index);
|
---|
28 | end
|
---|
29 |
|
---|
30 | for j=1:size(H_new,2)
|
---|
31 | u(i,j)= next_u(j);
|
---|
32 | end
|
---|
33 | end
|
---|
34 |
|
---|
35 | zero(i,:)=next_zero;
|
---|
36 | range(i,:)=next_range;
|
---|
37 | eigvec(i,:,:)=next_eigvec;
|
---|
38 | end
|
---|
39 | end |
---|