本文整理汇总了C#中barycentricinterpolant类的典型用法代码示例。如果您正苦于以下问题:C# barycentricinterpolant类的具体用法?C# barycentricinterpolant怎么用?C# barycentricinterpolant使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
barycentricinterpolant类属于命名空间,在下文中一共展示了barycentricinterpolant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: F
/*************************************************************************
Rational interpolation using barycentric formula
F(t) = SUM(i=0,n-1,w[i]*f[i]/(t-x[i])) / SUM(i=0,n-1,w[i]/(t-x[i]))
Input parameters:
B - barycentric interpolant built with one of model building
subroutines.
T - interpolation point
Result:
barycentric interpolant F(t)
-- ALGLIB --
Copyright 17.08.2009 by Bochkanov Sergey
*************************************************************************/
public static double barycentriccalc(ref barycentricinterpolant b,
double t)
{
double result = 0;
double s1 = 0;
double s2 = 0;
double s = 0;
double v = 0;
int i = 0;
//
// special case: N=1
//
if( b.n==1 )
{
result = b.sy*b.y[0];
return result;
}
//
// Here we assume that task is normalized, i.e.:
// 1. abs(Y[i])<=1
// 2. abs(W[i])<=1
// 3. X[] is ordered
//
s = Math.Abs(t-b.x[0]);
for(i=0; i<=b.n-1; i++)
{
v = b.x[i];
if( (double)(v)==(double)(t) )
{
result = b.sy*b.y[i];
return result;
}
v = Math.Abs(t-v);
if( (double)(v)<(double)(s) )
{
s = v;
}
}
s1 = 0;
s2 = 0;
for(i=0; i<=b.n-1; i++)
{
v = s/(t-b.x[i]);
v = v*b.w[i];
s1 = s1+v*b.y[i];
s2 = s2+v;
}
result = b.sy*s1/s2;
return result;
}
示例2: MaxRealNumber
/*************************************************************************
Differentiation of barycentric interpolant: first derivative.
Algorithm used in this subroutine is very robust and should not fail until
provided with values too close to MaxRealNumber (usually MaxRealNumber/N
or greater will overflow).
INPUT PARAMETERS:
B - barycentric interpolant built with one of model building
subroutines.
T - interpolation point
OUTPUT PARAMETERS:
F - barycentric interpolant at T
DF - first derivative
NOTE
-- ALGLIB --
Copyright 17.08.2009 by Bochkanov Sergey
*************************************************************************/
public static void barycentricdiff1(barycentricinterpolant b,
double t,
ref double f,
ref double df)
{
double v = 0;
double vv = 0;
int i = 0;
int k = 0;
double n0 = 0;
double n1 = 0;
double d0 = 0;
double d1 = 0;
double s0 = 0;
double s1 = 0;
double xk = 0;
double xi = 0;
double xmin = 0;
double xmax = 0;
double xscale1 = 0;
double xoffs1 = 0;
double xscale2 = 0;
double xoffs2 = 0;
double xprev = 0;
f = 0;
df = 0;
alglib.ap.assert(!Double.IsInfinity(t), "BarycentricDiff1: infinite T!");
//
// special case: NaN
//
if( Double.IsNaN(t) )
{
f = Double.NaN;
df = Double.NaN;
return;
}
//
// special case: N=1
//
if( b.n==1 )
{
f = b.sy*b.y[0];
df = 0;
return;
}
if( (double)(b.sy)==(double)(0) )
{
f = 0;
df = 0;
return;
}
alglib.ap.assert((double)(b.sy)>(double)(0), "BarycentricDiff1: internal error");
//
// We assume than N>1 and B.SY>0. Find:
// 1. pivot point (X[i] closest to T)
// 2. width of interval containing X[i]
//
v = Math.Abs(b.x[0]-t);
k = 0;
xmin = b.x[0];
xmax = b.x[0];
for(i=1; i<=b.n-1; i++)
{
vv = b.x[i];
if( (double)(Math.Abs(vv-t))<(double)(v) )
{
v = Math.Abs(vv-t);
k = i;
}
xmin = Math.Min(xmin, vv);
xmax = Math.Max(xmax, vv);
}
//.........这里部分代码省略.........
示例3: make_copy
public override alglib.apobject make_copy()
{
barycentricinterpolant _result = new barycentricinterpolant();
_result.n = n;
_result.sy = sy;
_result.x = (double[])x.Clone();
_result.y = (double[])y.Clone();
_result.w = (double[])w.Clone();
return _result;
}
示例4: D
/*************************************************************************
Rational least squares fitting using Floater-Hormann rational functions
with optimal D chosen from [0,9].
Equidistant grid with M node on [min(x),max(x)] is used to build basis
functions. Different values of D are tried, optimal D (least root mean
square error) is chosen. Task is linear, so linear least squares solver
is used. Complexity of this computational scheme is O(N*M^2) (mostly
dominated by the least squares solver).
INPUT PARAMETERS:
X - points, array[0..N-1].
Y - function values, array[0..N-1].
N - number of points, N>0.
M - number of basis functions ( = number_of_nodes), M>=2.
OUTPUT PARAMETERS:
Info- same format as in LSFitLinearWC() subroutine.
* Info>0 task is solved
* Info<=0 an error occured:
-4 means inconvergence of internal SVD
-3 means inconsistent constraints
B - barycentric interpolant.
Rep - report, same format as in LSFitLinearWC() subroutine.
Following fields are set:
* DBest best value of the D parameter
* RMSError rms error on the (X,Y).
* AvgError average error on the (X,Y).
* AvgRelError average relative error on the non-zero Y
* MaxError maximum error
NON-WEIGHTED ERRORS ARE CALCULATED
-- ALGLIB PROJECT --
Copyright 18.08.2009 by Bochkanov Sergey
*************************************************************************/
public static void barycentricfitfloaterhormann(double[] x, double[] y, int n, int m, out int info, out barycentricinterpolant b, out barycentricfitreport rep)
{
info = 0;
b = new barycentricinterpolant();
rep = new barycentricfitreport();
lsfit.barycentricfitfloaterhormann(x, y, n, m, ref info, b.innerobj, rep.innerobj);
return;
}
示例5: barycentriccalcbasis
/*************************************************************************
Internal subroutine, calculates barycentric basis functions.
Used for efficient simultaneous calculation of N basis functions.
-- ALGLIB --
Copyright 17.08.2009 by Bochkanov Sergey
*************************************************************************/
private static void barycentriccalcbasis(ref barycentricinterpolant b,
double t,
ref double[] y)
{
double s2 = 0;
double s = 0;
double v = 0;
int i = 0;
int j = 0;
int i_ = 0;
//
// special case: N=1
//
if( b.n==1 )
{
y[0] = 1;
return;
}
//
// Here we assume that task is normalized, i.e.:
// 1. abs(Y[i])<=1
// 2. abs(W[i])<=1
// 3. X[] is ordered
//
// First, we decide: should we use "safe" formula (guarded
// against overflow) or fast one?
//
s = Math.Abs(t-b.x[0]);
for(i=0; i<=b.n-1; i++)
{
v = b.x[i];
if( (double)(v)==(double)(t) )
{
for(j=0; j<=b.n-1; j++)
{
y[j] = 0;
}
y[i] = 1;
return;
}
v = Math.Abs(t-v);
if( (double)(v)<(double)(s) )
{
s = v;
}
}
s2 = 0;
for(i=0; i<=b.n-1; i++)
{
v = s/(t-b.x[i]);
v = v*b.w[i];
y[i] = v;
s2 = s2+v;
}
v = 1/s2;
for(i_=0; i_<=b.n-1;i_++)
{
y[i_] = v*y[i_];
}
}
示例6: interpolant
/*************************************************************************
Copying of the barycentric interpolant (for internal use only)
INPUT PARAMETERS:
B - barycentric interpolant
OUTPUT PARAMETERS:
B2 - copy(B1)
-- ALGLIB --
Copyright 17.08.2009 by Bochkanov Sergey
*************************************************************************/
public static void barycentriccopy(barycentricinterpolant b,
barycentricinterpolant b2)
{
int i_ = 0;
b2.n = b.n;
b2.sy = b.sy;
b2.x = new double[b2.n];
b2.y = new double[b2.n];
b2.w = new double[b2.n];
for(i_=0; i_<=b2.n-1;i_++)
{
b2.x[i_] = b.x[i_];
}
for(i_=0; i_<=b2.n-1;i_++)
{
b2.y[i_] = b.y[i_];
}
for(i_=0; i_<=b2.n-1;i_++)
{
b2.w[i_] = b.w[i_];
}
}
示例7: F
/*************************************************************************
Rational interpolant from X/Y/W arrays
F(t) = SUM(i=0,n-1,w[i]*f[i]/(t-x[i])) / SUM(i=0,n-1,w[i]/(t-x[i]))
INPUT PARAMETERS:
X - interpolation nodes, array[0..N-1]
F - function values, array[0..N-1]
W - barycentric weights, array[0..N-1]
N - nodes count, N>0
OUTPUT PARAMETERS:
B - barycentric interpolant built from (X, Y, W)
-- ALGLIB --
Copyright 17.08.2009 by Bochkanov Sergey
*************************************************************************/
public static void barycentricbuildxyw(double[] x,
double[] y,
double[] w,
int n,
barycentricinterpolant b)
{
int i_ = 0;
alglib.ap.assert(n>0, "BarycentricBuildXYW: incorrect N!");
//
// fill X/Y/W
//
b.x = new double[n];
b.y = new double[n];
b.w = new double[n];
for(i_=0; i_<=n-1;i_++)
{
b.x[i_] = x[i_];
}
for(i_=0; i_<=n-1;i_++)
{
b.y[i_] = y[i_];
}
for(i_=0; i_<=n-1;i_++)
{
b.w[i_] = w[i_];
}
b.n = n;
//
// Normalize
//
barycentricnormalize(b);
}
示例8: B2
/*************************************************************************
This subroutine performs linear transformation of the barycentric
interpolant.
INPUT PARAMETERS:
B - rational interpolant in barycentric form
CA, CB - transformation coefficients: B2(x) = CA*B(x) + CB
OUTPUT PARAMETERS:
B - transformed interpolant
-- ALGLIB PROJECT --
Copyright 19.08.2009 by Bochkanov Sergey
*************************************************************************/
public static void barycentriclintransy(barycentricinterpolant b,
double ca,
double cb)
{
int i = 0;
double v = 0;
int i_ = 0;
for(i=0; i<=b.n-1; i++)
{
b.y[i] = ca*b.sy*b.y[i]+cb;
}
b.sy = 0;
for(i=0; i<=b.n-1; i++)
{
b.sy = Math.Max(b.sy, Math.Abs(b.y[i]));
}
if( (double)(b.sy)>(double)(0) )
{
v = 1/b.sy;
for(i_=0; i_<=b.n-1;i_++)
{
b.y[i_] = v*b.y[i_];
}
}
}
示例9: D
/*************************************************************************
Weghted rational least squares fitting using Floater-Hormann rational
functions with optimal D chosen from [0,9], with constraints and
individual weights.
Equidistant grid with M node on [min(x),max(x)] is used to build basis
functions. Different values of D are tried, optimal D (least WEIGHTED root
mean square error) is chosen. Task is linear, so linear least squares
solver is used. Complexity of this computational scheme is O(N*M^2)
(mostly dominated by the least squares solver).
SEE ALSO
* BarycentricFitFloaterHormann(), "lightweight" fitting without invididual
weights and constraints.
INPUT PARAMETERS:
X - points, array[0..N-1].
Y - function values, array[0..N-1].
W - weights, array[0..N-1]
Each summand in square sum of approximation deviations from
given values is multiplied by the square of corresponding
weight. Fill it by 1's if you don't want to solve weighted
task.
N - number of points, N>0.
XC - points where function values/derivatives are constrained,
array[0..K-1].
YC - values of constraints, array[0..K-1]
DC - array[0..K-1], types of constraints:
* DC[i]=0 means that S(XC[i])=YC[i]
* DC[i]=1 means that S'(XC[i])=YC[i]
SEE BELOW FOR IMPORTANT INFORMATION ON CONSTRAINTS
K - number of constraints, 0<=K<M.
K=0 means no constraints (XC/YC/DC are not used in such cases)
M - number of basis functions ( = number_of_nodes), M>=2.
OUTPUT PARAMETERS:
Info- same format as in LSFitLinearWC() subroutine.
* Info>0 task is solved
* Info<=0 an error occured:
-4 means inconvergence of internal SVD
-3 means inconsistent constraints
-1 means another errors in parameters passed
(N<=0, for example)
B - barycentric interpolant.
Rep - report, same format as in LSFitLinearWC() subroutine.
Following fields are set:
* DBest best value of the D parameter
* RMSError rms error on the (X,Y).
* AvgError average error on the (X,Y).
* AvgRelError average relative error on the non-zero Y
* MaxError maximum error
NON-WEIGHTED ERRORS ARE CALCULATED
IMPORTANT:
this subroitine doesn't calculate task's condition number for K<>0.
SETTING CONSTRAINTS - DANGERS AND OPPORTUNITIES:
Setting constraints can lead to undesired results, like ill-conditioned
behavior, or inconsistency being detected. From the other side, it allows
us to improve quality of the fit. Here we summarize our experience with
constrained barycentric interpolants:
* excessive constraints can be inconsistent. Floater-Hormann basis
functions aren't as flexible as splines (although they are very smooth).
* the more evenly constraints are spread across [min(x),max(x)], the more
chances that they will be consistent
* the greater is M (given fixed constraints), the more chances that
constraints will be consistent
* in the general case, consistency of constraints IS NOT GUARANTEED.
* in the several special cases, however, we CAN guarantee consistency.
* one of this cases is constraints on the function VALUES at the interval
boundaries. Note that consustency of the constraints on the function
DERIVATIVES is NOT guaranteed (you can use in such cases cubic splines
which are more flexible).
* another special case is ONE constraint on the function value (OR, but
not AND, derivative) anywhere in the interval
Our final recommendation is to use constraints WHEN AND ONLY WHEN you
can't solve your task without them. Anything beyond special cases given
above is not guaranteed and may result in inconsistency.
-- ALGLIB PROJECT --
Copyright 18.08.2009 by Bochkanov Sergey
*************************************************************************/
public static void barycentricfitfloaterhormannwc(ref double[] x,
ref double[] y,
ref double[] w,
int n,
ref double[] xc,
ref double[] yc,
ref int[] dc,
int k,
int m,
ref int info,
ref barycentricinterpolant b,
ref barycentricfitreport rep)
{
int d = 0;
int i = 0;
double wrmscur = 0;
//.........这里部分代码省略.........
示例10: barycentricunserialize
/*************************************************************************
Unserialization of the barycentric interpolant
INPUT PARAMETERS:
RA - array of real numbers which contains interpolant,
OUTPUT PARAMETERS:
B - barycentric interpolant
-- ALGLIB --
Copyright 17.08.2009 by Bochkanov Sergey
*************************************************************************/
public static void barycentricunserialize(ref double[] ra,
ref barycentricinterpolant b)
{
int i_ = 0;
int i1_ = 0;
System.Diagnostics.Debug.Assert((int)Math.Round(ra[1])==brcvnum, "BarycentricUnserialize: corrupted array!");
b.n = (int)Math.Round(ra[2]);
b.sy = ra[3];
b.x = new double[b.n];
b.y = new double[b.n];
b.w = new double[b.n];
i1_ = (4) - (0);
for(i_=0; i_<=b.n-1;i_++)
{
b.x[i_] = ra[i_+i1_];
}
i1_ = (4+b.n) - (0);
for(i_=0; i_<=b.n-1;i_++)
{
b.y[i_] = ra[i_+i1_];
}
i1_ = (4+2*b.n) - (0);
for(i_=0; i_<=b.n-1;i_++)
{
b.w[i_] = ra[i_+i1_];
}
}
示例11: barycentricserialize
/*************************************************************************
Serialization of the barycentric interpolant
INPUT PARAMETERS:
B - barycentric interpolant
OUTPUT PARAMETERS:
RA - array of real numbers which contains interpolant,
array[0..RLen-1]
RLen - RA lenght
-- ALGLIB --
Copyright 17.08.2009 by Bochkanov Sergey
*************************************************************************/
public static void barycentricserialize(ref barycentricinterpolant b,
ref double[] ra,
ref int ralen)
{
int i_ = 0;
int i1_ = 0;
ralen = 2+2+3*b.n;
ra = new double[ralen];
ra[0] = ralen;
ra[1] = brcvnum;
ra[2] = b.n;
ra[3] = b.sy;
i1_ = (0) - (4);
for(i_=4; i_<=4+b.n-1;i_++)
{
ra[i_] = b.x[i_+i1_];
}
i1_ = (0) - (4+b.n);
for(i_=4+b.n; i_<=4+2*b.n-1;i_++)
{
ra[i_] = b.y[i_+i1_];
}
i1_ = (0) - (4+2*b.n);
for(i_=4+2*b.n; i_<=4+3*b.n-1;i_++)
{
ra[i_] = b.w[i_+i1_];
}
}
示例12: barycentricfitwcfixedd
/*************************************************************************
Internal Floater-Hormann fitting subroutine for fixed D
*************************************************************************/
private static void barycentricfitwcfixedd(double[] x,
double[] y,
ref double[] w,
int n,
double[] xc,
double[] yc,
ref int[] dc,
int k,
int m,
int d,
ref int info,
ref barycentricinterpolant b,
ref barycentricfitreport rep)
{
double[,] fmatrix = new double[0,0];
double[,] cmatrix = new double[0,0];
double[] y2 = new double[0];
double[] w2 = new double[0];
double[] sx = new double[0];
double[] sy = new double[0];
double[] sbf = new double[0];
double[] xoriginal = new double[0];
double[] yoriginal = new double[0];
double[] tmp = new double[0];
lsfit.lsfitreport lrep = new lsfit.lsfitreport();
double v0 = 0;
double v1 = 0;
double mx = 0;
barycentricinterpolant b2 = new barycentricinterpolant();
int i = 0;
int j = 0;
int relcnt = 0;
double xa = 0;
double xb = 0;
double sa = 0;
double sb = 0;
double decay = 0;
int i_ = 0;
x = (double[])x.Clone();
y = (double[])y.Clone();
xc = (double[])xc.Clone();
yc = (double[])yc.Clone();
if( n<1 | m<2 | k<0 | k>=m )
{
info = -1;
return;
}
for(i=0; i<=k-1; i++)
{
info = 0;
if( dc[i]<0 )
{
info = -1;
}
if( dc[i]>1 )
{
info = -1;
}
if( info<0 )
{
return;
}
}
//
// weight decay for correct handling of task which becomes
// degenerate after constraints are applied
//
decay = 10000*AP.Math.MachineEpsilon;
//
// Scale X, Y, XC, YC
//
lsfit.lsfitscalexy(ref x, ref y, n, ref xc, ref yc, ref dc, k, ref xa, ref xb, ref sa, ref sb, ref xoriginal, ref yoriginal);
//
// allocate space, initialize:
// * FMatrix- values of basis functions at X[]
// * CMatrix- values (derivatives) of basis functions at XC[]
//
y2 = new double[n+m];
w2 = new double[n+m];
fmatrix = new double[n+m, m];
if( k>0 )
{
cmatrix = new double[k, m+1];
}
y2 = new double[n+m];
w2 = new double[n+m];
//
// Prepare design and constraints matrices:
// * fill constraints matrix
// * fill first N rows of design matrix with values
// * fill next M rows of design matrix with regularizing term
//.........这里部分代码省略.........
示例13: BarycentricDiff1
/*************************************************************************
Differentiation of barycentric interpolant: first/second derivatives.
INPUT PARAMETERS:
B - barycentric interpolant built with one of model building
subroutines.
T - interpolation point
OUTPUT PARAMETERS:
F - barycentric interpolant at T
DF - first derivative
D2F - second derivative
NOTE: this algorithm may fail due to overflow/underflor if used on data
whose values are close to MaxRealNumber or MinRealNumber. Use more robust
BarycentricDiff1() subroutine in such cases.
-- ALGLIB --
Copyright 17.08.2009 by Bochkanov Sergey
*************************************************************************/
public static void barycentricdiff2(barycentricinterpolant b,
double t,
ref double f,
ref double df,
ref double d2f)
{
double v = 0;
double vv = 0;
int i = 0;
int k = 0;
double n0 = 0;
double n1 = 0;
double n2 = 0;
double d0 = 0;
double d1 = 0;
double d2 = 0;
double s0 = 0;
double s1 = 0;
double s2 = 0;
double xk = 0;
double xi = 0;
f = 0;
df = 0;
d2f = 0;
alglib.ap.assert(!Double.IsInfinity(t), "BarycentricDiff1: infinite T!");
//
// special case: NaN
//
if( Double.IsNaN(t) )
{
f = Double.NaN;
df = Double.NaN;
d2f = Double.NaN;
return;
}
//
// special case: N=1
//
if( b.n==1 )
{
f = b.sy*b.y[0];
df = 0;
d2f = 0;
return;
}
if( (double)(b.sy)==(double)(0) )
{
f = 0;
df = 0;
d2f = 0;
return;
}
//
// We assume than N>1 and B.SY>0. Find:
// 1. pivot point (X[i] closest to T)
// 2. width of interval containing X[i]
//
alglib.ap.assert((double)(b.sy)>(double)(0), "BarycentricDiff: internal error");
f = 0;
df = 0;
d2f = 0;
v = Math.Abs(b.x[0]-t);
k = 0;
for(i=1; i<=b.n-1; i++)
{
vv = b.x[i];
if( (double)(Math.Abs(vv-t))<(double)(v) )
{
v = Math.Abs(vv-t);
k = i;
}
}
//
//.........这里部分代码省略.........
示例14: PolynomialFitWC
/*************************************************************************
Fitting by polynomials in barycentric form. This function provides simple
unterface for unconstrained unweighted fitting. See PolynomialFitWC() if
you need constrained fitting.
Task is linear, so linear least squares solver is used. Complexity of this
computational scheme is O(N*M^2), mostly dominated by least squares solver
SEE ALSO:
PolynomialFitWC()
INPUT PARAMETERS:
X - points, array[0..N-1].
Y - function values, array[0..N-1].
N - number of points, N>0
* if given, only leading N elements of X/Y are used
* if not given, automatically determined from sizes of X/Y
M - number of basis functions (= polynomial_degree + 1), M>=1
OUTPUT PARAMETERS:
Info- same format as in LSFitLinearW() subroutine:
* Info>0 task is solved
* Info<=0 an error occured:
-4 means inconvergence of internal SVD
P - interpolant in barycentric form.
Rep - report, same format as in LSFitLinearW() subroutine.
Following fields are set:
* RMSError rms error on the (X,Y).
* AvgError average error on the (X,Y).
* AvgRelError average relative error on the non-zero Y
* MaxError maximum error
NON-WEIGHTED ERRORS ARE CALCULATED
NOTES:
you can convert P from barycentric form to the power or Chebyshev
basis with PolynomialBar2Pow() or PolynomialBar2Cheb() functions from
POLINT subpackage.
-- ALGLIB PROJECT --
Copyright 10.12.2009 by Bochkanov Sergey
*************************************************************************/
public static void polynomialfit(double[] x, double[] y, int n, int m, out int info, out barycentricinterpolant p, out polynomialfitreport rep)
{
info = 0;
p = new barycentricinterpolant();
rep = new polynomialfitreport();
lsfit.polynomialfit(x, y, n, m, ref info, p.innerobj, rep.innerobj);
return;
}
示例15: barycentriclintransx
/*************************************************************************
This subroutine performs linear transformation of the argument.
INPUT PARAMETERS:
B - rational interpolant in barycentric form
CA, CB - transformation coefficients: x = CA*t + CB
OUTPUT PARAMETERS:
B - transformed interpolant with X replaced by T
-- ALGLIB PROJECT --
Copyright 19.08.2009 by Bochkanov Sergey
*************************************************************************/
public static void barycentriclintransx(barycentricinterpolant b,
double ca,
double cb)
{
int i = 0;
int j = 0;
double v = 0;
//
// special case, replace by constant F(CB)
//
if( (double)(ca)==(double)(0) )
{
b.sy = barycentriccalc(b, cb);
v = 1;
for(i=0; i<=b.n-1; i++)
{
b.y[i] = 1;
b.w[i] = v;
v = -v;
}
return;
}
//
// general case: CA<>0
//
for(i=0; i<=b.n-1; i++)
{
b.x[i] = (b.x[i]-cb)/ca;
}
if( (double)(ca)<(double)(0) )
{
for(i=0; i<=b.n-1; i++)
{
if( i<b.n-1-i )
{
j = b.n-1-i;
v = b.x[i];
b.x[i] = b.x[j];
b.x[j] = v;
v = b.y[i];
b.y[i] = b.y[j];
b.y[j] = v;
v = b.w[i];
b.w[i] = b.w[j];
b.w[j] = v;
}
else
{
break;
}
}
}
}