source: tol/tol_pkg/MulVarFunAprox/DesignC2.Spheric.tol @ 3f198cc

1941-docker-image-to-testdevel
Last change on this file since 3f198cc was 3f198cc, checked in by Víctor de Buen <vdebuen@…>, 17 years ago

Preparando para permitir radio variante en los entornos esféricos

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@1885 be4846ae-f051-483a-831f-b64e7d08527f

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/* -*- mode: C++ -*- */
2//////////////////////////////////////////////////////////////////////////////
3// FILE   : DesignC2.tol
4// PURPOSE: Defines Class @DesignC2
5//////////////////////////////////////////////////////////////////////////////
6
7
8//////////////////////////////////////////////////////////////////////////////
9Text _.autodoc.member.DesignC2.Spheric =
10"";
11Class @DesignC2.Spheric : @DesignC2
12//////////////////////////////////////////////////////////////////////////////
13{
14  //////////////////////////////////////////////////////////////////////////////
15  //Virtual methods
16  //////////////////////////////////////////////////////////////////////////////
17  VMatrix get.radius(VMatrix Y.idx);
18
19  ///////////////////////////////////////////////////////////////////////////
20  Set get.X.weight(Set X.dif, Set X.h)
21  ///////////////////////////////////////////////////////////////////////////
22  {
23    Real m = VRows(X.dif[1]);
24    Set X.tao = For(1,_.X.maxNeighbour,VMatrix(Real i)
25    {
26      VMatrix X.norm2 = RPow(X.dif[i],2)*Rand(_.n,1,1,1);
27      RPow(X.norm2,0.5)$/get.radius(X.h[i])
28    });
29    Set X.tao2 = For(1,_.X.maxNeighbour,VMatrix(Real i)
30    {
31      RPow(X.tao[i],2)
32    });
33    Set X.match = For(1,_.X.maxNeighbour,VMatrix(Real i)
34    {
35      LE(X.tao[i],Rand(m,1,1,1))
36    });
37    Set X.lambda = For(1,_.X.maxNeighbour,VMatrix(Real i)
38    {
39      RPow(X.match[i] $* (Rand(m,1,1,1)-X.tao2[i]),4)
40    });
41    VMatrix X.lambda.sum = SetSum(X.lambda);
42   
43    For(1,_.X.maxNeighbour,VMatrix(Real i)
44    {
45      X.lambda[i] $/ X.lambda.sum
46    })
47  };
48  ///////////////////////////////////////////////////////////////////////////
49  Set get.X.weight.partial.derivative.1(Set X.dif, Set X.h, Real s)
50  ///////////////////////////////////////////////////////////////////////////
51  {
52    Real m = VRows(X.dif[1]);
53    Set X.tao = For(1,_.X.maxNeighbour,VMatrix(Real i)
54    {
55      VMatrix X.norm2 = RPow(X.dif[i],2)*Rand(_.n,1,1,1);
56      RPow(X.norm2,0.5)$/get.radius(X.h[i])
57    });
58    Set X.tao2 = For(1,_.X.maxNeighbour,VMatrix(Real i)
59    {
60      RPow(X.tao[i],2)
61    });
62    Set X.match = For(1,_.X.maxNeighbour,VMatrix(Real i)
63    {
64      LE(X.tao[i],Rand(m,1,1,1))
65    });
66    Set X.lambda = For(1,_.X.maxNeighbour,VMatrix(Real i)
67    {
68      RPow(X.match[i] $* (Rand(m,1,1,1)-X.tao2[i]),4)
69    });
70    Set X.lambda.der = For(1,_.X.maxNeighbour,VMatrix(Real i)
71    {
72      RPow(X.match[i] $*
73           (Rand(m,1,1,1)-X.tao2[i]),3) $*
74           (SubCol(X.dif[i],[[s]])*8) $/ get.radius(X.h[i])
75    });
76    VMatrix X.lambda.sum = SetSum(X.lambda);
77    VMatrix X.lambda.sum.2 = RPow(X.lambda.sum,2);
78    VMatrix X.lambda.der.sum = SetSum(X.lambda.der);
79    For(1,_.X.maxNeighbour,VMatrix(Real i)
80    {
81      (X.lambda.der[i]$*X.lambda.sum-X.lambda[i]$*X.lambda.der.sum)
82      $/ X.lambda.sum.2
83    })
84  }
85
86};
Note: See TracBrowser for help on using the repository browser.