Changeset 7dd69db in tol


Ignore:
Timestamp:
Jan 5, 2010, 7:27:53 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
c62037e
Parents:
a693055
Message:

Renombrado de métodos

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol_pkg/FunRn2R/BaseC2.LinComb.tol

    ra693055 r7dd69db  
    3434
    3535  ////////////////////////////////////////////////////////////////////////////
    36   Static Text _.autodoc.member.Compact.Ratio = "Creates an instance of "
    37   "@BaseC2.LinComb that is close to be orthonormal and has at least "
    38   "the specified ratio of information of original base";
    39   Static @BaseC2.LinComb Compact.Ratio(
     36  Static Text _.autodoc.member.Orthogonal = "Creates an instance of "
     37  "@BaseC2.LinComb that is orthonormal for given points and has exactly K "
     38  "elements";
     39  Static @BaseC2.LinComb Orthogonal(
    4040    @BaseC2 base,
    41     Real informationRatio)
     41    Real K,
     42    VMatrix u)
    4243  ////////////////////////////////////////////////////////////////////////////
    4344  {
    44     Real K1 = base::_.K;
    45 
    46     VMatrix u = Rand(K1*10, K1, -1, 1);
    47 
    48     VMatrix Pu = Group("ConcatColumns", For(1, K1, VMatrix(Real k)
    49     {
    50       base::function.v(k,u)
    51     }));
    52 
    53     Set Pu.svd = SVD(VMat2Mat(Pu));
    54 
    55     Matrix Pu.eigenvalue = Tra(SubDiag(Pu.svd[2],0));
    56     Matrix Pu.eigenvalueCum =
    57     {
    58        Matrix aux = DifEq(1/(1-B),Pu.eigenvalue);
    59        aux*(1/MatSum(Pu.eigenvalue))
    60     };
    61     Matrix ratio = Rand(K1,1,informationRatio,informationRatio);
    62     Real K = MatSum(LE(Pu.eigenvalueCum,ratio));
    63     Set range.K = Range(1,K,1);
    64     VMatrix V = Mat2VMat(SubCol(Pu.svd[3],range.K));
    65     VMatrix D = Eye(K,K,0,RPow(Mat2VMat(SubRow(Pu.eigenvalue,range.K)),+1));
    66     VMatrix Di = Eye(K,K,0,RPow(Mat2VMat(SubRow(Pu.eigenvalue,range.K)),-1));
    67     VMatrix W = V*Di;
    68     VMatrix Wi = D*Tra(V);
    69     New(base, W, Wi)
    70   };
    71 
    72   ////////////////////////////////////////////////////////////////////////////
    73   Static Text _.autodoc.member.Compact.K = "Creates an instance of "
    74   "@BaseC2.LinComb that is close to be orthonormal and has exactly K "
    75   "elements";
    76   Static @BaseC2.LinComb Compact.K(
    77     @BaseC2 base,
    78     Real K)
    79   ////////////////////////////////////////////////////////////////////////////
    80   {
    81     Set aux = [[
    8245    Set range.K = Range(1,K,1);
    8346    Real n = base::_.n;
    8447    Real K1 = base::_.K;
    85 
    86     VMatrix u = Gaussian(K1, n, 0, 1);
    87   //VMatrix u = Eye(K1,n);
    88   //WriteLn("TRACE [@BaseC2.LinComb Compact.K] u:"<<u);
    8948    Real base::upgrade.cache(u,0,0);
    9049    VMatrix Pu = Group("ConcatColumns", For(1, K1, VMatrix(Real k)
    … …  
    10059    VMatrix Di = Eye(K,K,0,RPow(Mat2VMat(SubRow(Pu.eigenvalue,range.K)),-1));
    10160    VMatrix W = V*Di;
    102     VMatrix Wi = D*Tra(V) ]];
     61    VMatrix Wi = D*Tra(V);
    10362    @BaseC2.LinComb new = New(base, W, Wi);
    104     Set new::_.aux := aux;
     63    Set new::_.aux :=
     64    [[
     65      K,n,K1,u,Pu,Pu.svd,Pu.eigenvalue,V,D,Di,W,Wi
     66    ]];
    10567    new
     68  };
     69
     70  ////////////////////////////////////////////////////////////////////////////
     71  Static Text _.autodoc.member.Orthogonal.Rand = "Creates an instance of "
     72  "@BaseC2.LinComb that is orthonormal for random points and has exactly K "
     73  "elements";
     74  Static @BaseC2.LinComb Orthogonal.Rand(
     75    @BaseC2 base,
     76    Real K)
     77  ////////////////////////////////////////////////////////////////////////////
     78  {
     79    Orthogonal(base,K,Gaussian(10*base::_.K, base::_.n, 0, 1))
    10680  };
    10781
Note: See TracChangeset for help on using the changeset viewer.