@@ -856,6 +856,7 @@ def test_stumpi_identical_subsequence_self_join_egress():
856856def test_stumpi_profile_index_match ():
857857 T_full = np .random .rand (64 )
858858 m = 3
859+ T_full_subseq = core .rolling_window (T_full , m )
859860 warm_start = 8
860861
861862 T_stream = T_full [:warm_start ].copy ()
@@ -868,25 +869,21 @@ def test_stumpi_profile_index_match():
868869 t = T_full [i ]
869870 stream .update (t )
870871
871- for j in range (stream .I_ .shape [0 ]):
872- I = stream .I_ [j ]
873- left_I = stream .left_I_ [j ]
874-
875- if I < 0 :
876- P [j ] = np .inf
877- else :
878- P [j ] = naive .distance (
879- naive .z_norm (T_full [j + n + 1 : j + n + 1 + m ]),
880- naive .z_norm (T_full [I : I + m ]),
881- )
882-
883- if left_I < 0 :
884- left_P [j ] = np .inf
885- else :
886- left_P [j ] = naive .distance (
887- naive .z_norm (T_full [j + n + 1 : j + n + 1 + m ]),
888- naive .z_norm (T_full [left_I : left_I + m ]),
889- )
872+ P [:] = np .inf
873+ idx = np .argwhere (stream .I_ >= 0 ).flatten ()
874+ P [idx ] = naive .distance (
875+ naive .z_norm (T_full_subseq [idx + n + 1 ], axis = 1 ),
876+ naive .z_norm (T_full_subseq [stream .I_ [idx ]], axis = 1 ),
877+ axis = 1 ,
878+ )
879+
880+ left_P [:] = np .inf
881+ idx = np .argwhere (stream .left_I_ >= 0 ).flatten ()
882+ left_P [idx ] = naive .distance (
883+ naive .z_norm (T_full_subseq [idx + n + 1 ], axis = 1 ),
884+ naive .z_norm (T_full_subseq [stream .left_I_ [idx ]], axis = 1 ),
885+ axis = 1 ,
886+ )
890887
891888 npt .assert_almost_equal (stream .P_ , P )
892889 npt .assert_almost_equal (stream .left_P_ , left_P )
0 commit comments