Skip to content

Commit 62bdde9

Browse files
LegalizeAdulthoodmborland
authored andcommitted
Don't increment iterators beyond the end of the state vector
Fixes #95
1 parent 04442a4 commit 62bdde9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

examples/gram_schmidt.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ void gram_schmidt( StateType &x , LyapType &lyap , size_t n )
5555
norm[0] = sqrt( std::inner_product( beg1 , end1 , beg1 , 0.0 ) );
5656
normalize( beg1 , end1 , norm[0] );
5757

58-
beg1 += n;
59-
end1 += n;
60-
61-
for( size_t j=1 ; j<num_of_lyap ; ++j , beg1+=n , end1+=n )
58+
for( size_t j=1 ; j<num_of_lyap ; ++j )
6259
{
60+
beg1 += n;
61+
end1 += n;
62+
6363
for( size_t k=0 ; k<j ; ++k )
6464
{
6565
tmp[k] = std::inner_product( beg1 , end1 , first + k*n , 0.0 );

0 commit comments

Comments
 (0)