Changeset eddd23a in tol for tol_pkg/FunRn2R/BaseC2.LinComb.tol
- Timestamp:
- Nov 30, 2009, 1:54:17 PM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 4cbe84c
- Parents:
- ea3d3da
- File:
-
- 1 edited
-
tol_pkg/FunRn2R/BaseC2.LinComb.tol (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol_pkg/FunRn2R/BaseC2.LinComb.tol
rea3d3da reddd23a 5 5 ////////////////////////////////////////////////////////////////////////////// 6 6 7 ////////////////////////////////////////////////////////////////////////////// 7 8 Text _.autodoc.member.BaseC2.LinComb = "Defines a new base B2 of " 8 "order K2 as a linear combination B2= V*B1of functions of a previous base "9 "order K2 as a linear combination B2=B1*V of functions of a previous base " 9 10 "B1 of order K1>=K2. The matrix of change V must have rank K2 to ensure " 10 11 "linear independence."; 11 12 //////////////////////////////////////////////////////////////////////////////13 12 Class @BaseC2.LinComb : @BaseC2.Cache 14 13 ////////////////////////////////////////////////////////////////////////////// … … 19 18 //////////////////////////////////////////////////////////////////////////// 20 19 Static Text _.autodoc.member.New = "Creates an instance B2 of " 21 "@BaseC2.LinComb as B2 = V*B1";20 "@BaseC2.LinComb as B2 = B1*V"; 22 21 Static @BaseC2.LinComb New(@BaseC2 B1, VMatrix V) 23 22 //////////////////////////////////////////////////////////////////////////// 24 23 { 25 Real n = (B1[1])::_.n;24 Real n = B1::_.n; 26 25 27 @BaseC2. Concataux = [[26 @BaseC2.LinComb aux = [[ 28 27 Real _.n = B1::_.n; 29 Real _.K = V Rows(V);30 Set_.base = base;28 Real _.K = VColumns(V); 29 @BaseC2 _.base = base; 31 30 VMatrix _.V = V 32 31 ]]}; … … 52 51 Set Pu.svd = SVD(VMat2Mat(Pu)); 53 52 54 Matrix Pu.eigenvalue = RPow(Tra(SubDiag(Pu.svd[2],0)), 2);53 Matrix Pu.eigenvalue = RPow(Tra(SubDiag(Pu.svd[2],0)),1); 55 54 Matrix Pu.eigenvalueCum = 56 55 { … … 58 57 aux*(1/MatSum(Pu.eigenvalue)) 59 58 }; 60 VMatrix ratio = Rand(K1,1,informationRatio,informationRatio);59 Matrix ratio = Rand(K1,1,informationRatio,informationRatio); 61 60 Real K.new = MatSum(LE(Pu.eigenvalueCum,ratio)); 62 61 VMatrix V = Mat2VMat(SubCol(Pu.svd[3],Range(1,K.new,1))); … … 68 67 //////////////////////////////////////////////////////////////////////////// 69 68 { 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 73 72 }); 74 73 Set If(order>=1, { _.partial.derivative.1 := 75 74 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 }) 77 78 }); 78 79 Set If(order>=2, { _.partial.derivative.2 := … … 81 82 For(1, i, VMatrix(Real j) 82 83 { 83 _ V*_.base::partial.derivative.2.m(X,i,j)84 _.base::partial.derivative.2.m(X,i,j)*_.V 84 85 }) 85 86 })
Note: See TracChangeset
for help on using the changeset viewer.
