[ellipsoids] r2059 committed - issue #72...

2 views
Skip to first unread message

ellip...@googlecode.com

unread,
Jun 18, 2013, 8:20:58 PM6/18/13
to ellipsoids-change...@googlegroups.com
Revision: 2059
Author: swige.ide
Date: Tue Jun 18 17:20:46 2013
Log: issue #72
BugFix: GoodDirs* classes now use the pDynObj time vector to prevent
recalculation of spline.
http://code.google.com/p/ellipsoids/source/detail?r=2059

Modified:

/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/AGoodDirsContinuous.m

/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/GoodDirsContinuousGen.m

/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/GoodDirsContinuousLTI.m

/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/GoodDirsDiscrete.m

=======================================
---
/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/AGoodDirsContinuous.m
Sat Jun 15 10:38:17 2013
+++
/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/AGoodDirsContinuous.m
Tue Jun 18 17:20:46 2013
@@ -80,21 +80,29 @@
throwerror('wrongInput', ...
'sTime is expected to be among elements of timeVec');
end
- %
- matOpFactory = MatrixOperationsFactory.create(timeVec);
+ if (max(timeVec(:)) > max(timeLimsVec(:))) || ...
+ (min(timeVec(:)) < min(timeLimsVec(:)))
+ throwerror('wrongInput', ...
+ 'all timeVec elements are expected to be within %s',...
+ mat2str(timeLimsVec));
+ end
%
self.sTime = sTime;
%
- t0 = pDynObj.gett0();
- t1 = pDynObj.gett1();
+ STimeData.t0 = pDynObj.gett0();
+ STimeData.t1 = pDynObj.gett1();
+ STimeData.timeVec = timeVec;
+ STimeData.indSTime = indSTime;
+ %
+ matOpFactory = MatrixOperationsFactory.create(timeVec);
%
- [cXstNormDynamics, RstDynamics] = self.calcTransMatDynamics(...
- t0, t1, pDynObj.getAtDynamics(), calcPrecision);
+ [XstDynamics, RstDynamics, cXstNormDynamics] = ...
+ self.calcTransMatDynamics(matOpFactory, STimeData, ...
+ pDynObj.getAtDynamics(), calcPrecision);
%
+ self.XstNormDynamics = cXstNormDynamics;
+ self.XstTransDynamics = matOpFactory.transpose(XstDynamics);
self.RstTransDynamics = matOpFactory.transpose(RstDynamics);
- self.XstNormDynamics = cXstNormDynamics;
- self.XstTransDynamics = matOpFactory.rMultiplyByScalar(...
- self.RstTransDynamics, cXstNormDynamics);
%
[self.ltGoodDirCurveSpline, ...
self.ltGoodDirOneCurveSplineList] = ...
@@ -130,6 +138,7 @@
end
end
methods (Abstract, Access = protected)
- calcTransMatDynamics(self, t0, t1, AtDynamics, calcPrecision)
+ calcTransMatDynamics(matOpFactory, STimeData, AtDynamics, ...
+ calcPrecision)
end
end
=======================================
---
/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/GoodDirsContinuousGen.m
Mon Jun 17 01:43:05 2013
+++
/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/GoodDirsContinuousGen.m
Tue Jun 18 17:20:46 2013
@@ -2,7 +2,6 @@
properties (Constant, GetAccess = protected)
ODE_NORM_CONTROL = 'on';
CALC_PRECISION_FACTOR = 1e-5;
- CALC_CGRID_COUNT = 8000;
end
methods
function self = GoodDirsContinuousGen(pDynObj, sTime, ...
@@ -17,8 +16,9 @@
'RelTol', calcPrecision*self.CALC_PRECISION_FACTOR, ...
'AbsTol', calcPrecision*self.CALC_PRECISION_FACTOR};
end
- function [XstNormDynamics, RstDynamics] = calcTransMatDynamics(...
- self, t0, t1, AtDynamics, calcPrecision)
+ function [XstDynamics, RstDynamics, XstNormDynamics] = ...
+ calcTransMatDynamics(self, matOpFactory, STimeData, ...
+ AtDynamics, calcPrecision)
%
import gras.gen.matdot;
import gras.interp.MatrixInterpolantFactory;
@@ -41,16 +41,18 @@
%
% calculation of X(s, t) on [t0, s]
%
+ halfTimeVec = fliplr(STimeData.timeVec(1:STimeData.indSTime));
[timeRstVec, dataRstArray, dataXstNormArray] = ...
- self.calcHalfRstExtDynamics(self.sTime, t0, ...
+ self.calcHalfRstExtDynamics(halfTimeVec, ...
fRstExtDerivFunc, sRstInitialMat, sXstNormInitial, ...
calcPrecision, fRstPostProcFunc);
%
% calculation of X(s, t) on [s, t1]
%
+ halfTimeVec = STimeData.timeVec(STimeData.indSTime:end);
[timeRstRightVec, dataRstRightArray, ...
dataXstNormRightArray] = self.calcHalfRstExtDynamics(...
- self.sTime, t1, fRstExtDerivFunc, sRstInitialMat, ...
+ halfTimeVec, fRstExtDerivFunc, sRstInitialMat, ...
sXstNormInitial, calcPrecision);
%
if (length(timeRstRightVec) > 1)
@@ -61,10 +63,14 @@
dataXstNormRightArray(2:end));
end
%
- RstDynamics = MatrixInterpolantFactory.createInstance(...
- 'column', dataRstArray, timeRstVec);
XstNormDynamics = MatrixInterpolantFactory.createInstance(...
- 'scalar', dataXstNormArray, timeRstVec); % temp
+ 'scalar', dataXstNormArray, timeRstVec);
+ dataXstNormArray = permute(dataXstNormArray, [1 3 2]);
+ XstDynamics = MatrixInterpolantFactory.createInstance(...
+ 'column', dataRstArray .* repmat(dataXstNormArray, ...
+ [sizeSysVec, 1]), timeRstVec);
+ RstDynamics = MatrixInterpolantFactory.createInstance(...
+ 'column', dataRstArray, timeRstVec);
%
logger.info(...
sprintf(['calculating transition matrix spline ' ...
@@ -79,7 +85,7 @@
methods (Access = private)
function [timeRstHalfVec, dataRstHalfArray, ...
dataXstNormHalfArray] = calcHalfRstExtDynamics(self, ...
- startTime, endTime, fRstDerivFunc, sRstInitialMat, ...
+ timeVec, fRstDerivFunc, sRstInitialMat, ...
sXstNormInitial, calcPrecision, varargin)
%
import gras.ode.MatrixODESolver;
@@ -91,15 +97,13 @@
%
solverObj = MatrixODESolver(sizeSysVec, @ode45, ...
odeArgList{:});
- timeVec = linspace(startTime, endTime, ...
- self.CALC_CGRID_COUNT + 1);
[timeRstHalfVec, dataRstExtHalfArray] = solverObj.solve(...
fRstDerivFunc, timeVec, sRstExtInitialMat);
dataRstHalfArray = reshape(dataRstExtHalfArray(1:end-1,:), ...
[size(sRstInitialMat), length(timeRstHalfVec)]);
dataXstNormHalfArray = dataRstExtHalfArray(end,:);
%
- if nargin > 7
+ if nargin > 6
fRstPostProcFunc = varargin{1};
[timeRstHalfVec, dataRstHalfArray, ...
dataXstNormHalfArray] = fRstPostProcFunc(...
=======================================
---
/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/GoodDirsContinuousLTI.m
Sun Jun 16 14:06:06 2013
+++
/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/GoodDirsContinuousLTI.m
Tue Jun 18 17:20:46 2013
@@ -1,7 +1,4 @@
classdef GoodDirsContinuousLTI<gras.ellapx.lreachplain.AGoodDirsContinuous
- properties (Constant, GetAccess = protected)
- CALC_CGRID_COUNT = 8000;
- end
methods
function self = GoodDirsContinuousLTI(pDynObj, sTime, ...
lsGoodDirMat, calcPrecision)
@@ -10,27 +7,19 @@
end
end
methods (Access = protected)
- function [XstNormDynamics, RstDynamics] = calcTransMatDynamics(...
- self, t0, t1, AtDynamics, ~)
+ function [XstDynamics, RstDynamics, XstNormDynamics] = ...
+ calcTransMatDynamics(self, matOpFactory, STimeData, ...
+ AtDynamics, calcPrecision)
%
import gras.mat.MatrixOperationsFactory;
import gras.ellapx.uncertcalc.log.Log4jConfigurator;
%
logger=Log4jConfigurator.getLogger();
%
- timeRstVec = halfTimeVecGen(t0, self.sTime, ...
- self.CALC_CGRID_COUNT + 1);
- timeRstRightVec = halfTimeVecGen(self.sTime, t1, ...
- self.CALC_CGRID_COUNT + 1);
- if (length(timeRstRightVec) > 1)
- timeRstVec = cat(2, timeRstVec, timeRstRightVec(2:end));
- end
- %
tStart=tic;
%
% calculation of R(s, t) on [t0, t1]
%
- matOpFactory = MatrixOperationsFactory.create(timeRstVec);
AtUmDynamics = matOpFactory.uminus(AtDynamics);
XstDynamics = ...
matOpFactory.expmt(AtUmDynamics, self.sTime);
@@ -43,18 +32,8 @@
logger.info(...
sprintf(['calculating transition matrix exponent ' ...
'at time %d, nodes = %d, time elapsed = %s sec.'], ...
- self.sTime, length(timeRstVec), ...
+ self.sTime, length(STimeData.timeVec), ...
num2str(toc(tStart))));
end
end
end
-%
-% post processing function
-%
-function timeHalfVec = halfTimeVecGen(startTime, endTime, nVals)
- if (startTime == endTime)
- timeHalfVec = startTime;
- else
- timeHalfVec = linspace(startTime, endTime, nVals);
- end
-end
=======================================
---
/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/GoodDirsDiscrete.m
Thu Jun 6 02:50:13 2013
+++
/branches/issue_72_yadmiralsky/products/+gras/+ellapx/+lreachplain/GoodDirsDiscrete.m
Tue Jun 18 17:20:46 2013
@@ -7,8 +7,9 @@
end
end
methods (Access = protected)
- function [XstNormDynamics, RstDynamics] = calcTransMatDynamics(...
- self, t0, t1, AtDynamics, calcPrecision)
+ function [XstDynamics, RstDynamics, XstNormDynamics] = ...
+ calcTransMatDynamics(self, matOpFactory, STimeData, ...
+ AtDynamics, calcPrecision)
%
import gras.interp.MatrixInterpolantFactory;
import gras.ellapx.uncertcalc.log.Log4jConfigurator;
@@ -17,10 +18,14 @@
%
logger=Log4jConfigurator.getLogger();
%
- compOpFact = CompositeMatrixOperations();
- aInvMatFcn = compOpFact.inv(AtDynamics);
+ compOpFactory = CompositeMatrixOperations();
+ aInvMatFcn = compOpFactory.inv(AtDynamics);
fAtMat = @(t) aInvMatFcn.evaluate(t);
sizeSysVec = size(fAtMat(0));
+ %
+ t0 = STimeData.t0;
+ t1 = STimeData.t1;
+ %
isBack = t0 > t1;
if isBack
timeVec = fliplr(t1:t0);
@@ -49,6 +54,8 @@
dataXtt0NormVec(iTime);
end
%
+ XstDynamics = MatrixInterpolantFactory.createInstance(...
+ 'column', dataXtt0Arr, timeVec);
RstDynamics = MatrixInterpolantFactory.createInstance(...
'column', dataRtt0Arr, timeVec);
XstNormDynamics = MatrixInterpolantFactory.createInstance(...
Reply all
Reply to author
Forward
0 new messages