Ignore:
Timestamp:
Nov 30, 2009, 1:54:17 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
4cbe84c
Parents:
ea3d3da
Message:

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

File:
1 edited

Legend:

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

    rea3d3da reddd23a  
    55//////////////////////////////////////////////////////////////////////////////
    66
     7//////////////////////////////////////////////////////////////////////////////
    78Text _.autodoc.member.BaseC2.LinComb = "Defines a new base B2 of "
    8 "order K2 as a linear combination B2=V*B1 of functions of a previous base "
     9"order K2 as a linear combination B2=B1*V of functions of a previous base "
    910"B1 of order K1>=K2. The matrix of change V must have rank K2 to ensure "
    1011"linear independence.";
    11 
    12 //////////////////////////////////////////////////////////////////////////////
    1312Class @BaseC2.LinComb : @BaseC2.Cache
    1413//////////////////////////////////////////////////////////////////////////////
    … …  
    1918  ////////////////////////////////////////////////////////////////////////////
    2019  Static Text _.autodoc.member.New = "Creates an instance B2 of "
    21   "@BaseC2.LinComb as B2 = V*B1";
     20  "@BaseC2.LinComb as B2 = B1*V";
    2221  Static @BaseC2.LinComb New(@BaseC2 B1, VMatrix V)
    2322  ////////////////////////////////////////////////////////////////////////////
    2423  {
    25     Real n = (B1[1])::_.n;
     24    Real n = B1::_.n;
    2625   
    27     @BaseC2.Concat aux = [[
     26    @BaseC2.LinComb aux = [[
    2827      Real _.n = B1::_.n;
    29       Real _.K = VRows(V);
    30       Set _.base = base;
     28      Real _.K = VColumns(V);
     29      @BaseC2 _.base = base;
    3130      VMatrix _.V = V
    3231  ]]};
    … …  
    5251    Set Pu.svd = SVD(VMat2Mat(Pu));
    5352
    54     Matrix Pu.eigenvalue = RPow(Tra(SubDiag(Pu.svd[2],0)),2);
     53    Matrix Pu.eigenvalue = RPow(Tra(SubDiag(Pu.svd[2],0)),1);
    5554    Matrix Pu.eigenvalueCum =
    5655    {
    … …  
    5857       aux*(1/MatSum(Pu.eigenvalue))
    5958    };
    60     VMatrix ratio = Rand(K1,1,informationRatio,informationRatio);
     59    Matrix ratio = Rand(K1,1,informationRatio,informationRatio);
    6160    Real K.new = MatSum(LE(Pu.eigenvalueCum,ratio));
    6261    VMatrix V = Mat2VMat(SubCol(Pu.svd[3],Range(1,K.new,1)));
    … …  
    6867  ////////////////////////////////////////////////////////////////////////////
    6968  {
    70     Real _.base::upgrade.cache.v(order);
    71     VMatrix If(order>=0, { _.function.r :=
    72       _V*_.base::function.m(X)
     69    Real _.base::upgrade.cache(X,order);
     70    VMatrix If(order>=0, { _.function :=
     71      _.base::function.m(X)*_.V
    7372    });
    7473    Set If(order>=1, { _.partial.derivative.1 :=
    7574      For(1, _.n, VMatrix(Real i)
    76       { _V*_.base::partial.derivative.1.m(X,i) })
     75      {
     76        _.base::partial.derivative.1.m(X,i)*_.V
     77      })
    7778    });
    7879    Set If(order>=2, { _.partial.derivative.2 :=
    … …  
    8182        For(1, i, VMatrix(Real j)
    8283        {
    83           _V*_.base::partial.derivative.2.m(X,i,j)
     84          _.base::partial.derivative.2.m(X,i,j)*_.V
    8485        })
    8586      })
Note: See TracChangeset for help on using the changeset viewer.