2
* This file is part of TISEAN
4
* Copyright (c) 1998-2007 Rainer Hegger, Holger Kantz, Thomas Schreiber
6
* TISEAN is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* TISEAN is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with TISEAN; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
/* Author: Rainer Hegger
21
* Modified: Piotr Held <pjheld@gmail.com> (2015).
22
* This function is based on find_multi_neighbors of
23
* TISEAN 3.0.1 https://github.com/heggus/Tisean"
25
/********************************************************************/
26
/********************************************************************/
28
#include <octave/oct.h>
31
octave_idx_type find_multi_neighbors(const Matrix &s,
32
const MArray <octave_idx_type> &box,
33
long *list,double **x,
34
octave_idx_type bs,octave_idx_type dim,
35
octave_idx_type emb,octave_idx_type del,
36
double eps, unsigned long *flist)
41
octave_idx_type ib=bs-1;
42
octave_idx_type element;
43
octave_idx_type k1,i2;
45
octave_idx_type i=(octave_idx_type)(x[0][0]/eps)&ib;
46
octave_idx_type j=(octave_idx_type)(x[dim-1][0]/eps)&ib;
48
for (octave_idx_type i1=i-1;i1<=i+1;i1++)
51
for (octave_idx_type j1=j-1;j1<=j+1;j1++)
53
element=box(j1&ib,i2);
56
for (octave_idx_type k=0;k<emb;k++)
59
for (octave_idx_type li=0;li<dim;li++)
61
dx=std::fabs(x[li][k1]-s(element+k1,li));
70
element=list[element];
77
octave_idx_type find_multi_neighbors(const double ** s,
78
octave_idx_type **box,
79
long *list,const double **x,
80
octave_idx_type bs,octave_idx_type dim,
81
octave_idx_type emb,octave_idx_type del,
82
double eps, unsigned long *flist)
86
octave_idx_type ib=bs-1;
87
octave_idx_type element;
88
octave_idx_type k1,i2;
90
octave_idx_type i=(octave_idx_type)(x[0][0]/eps)&ib;
91
octave_idx_type j=(octave_idx_type)(x[dim-1][0]/eps)&ib;
93
for (octave_idx_type i1=i-1;i1<=i+1;i1++)
96
for (octave_idx_type j1=j-1;j1<=j+1;j1++)
98
element=box[i2][j1&ib];
101
for (octave_idx_type k=0;k<emb;k++)
104
for (octave_idx_type li=0;li<dim;li++)
106
dx=std::fabs(x[li][k1]-s[li][element+k1]);
115
element=list[element];