1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
function [poly] = tsgGetPolynomialSpaces(lGrid, bInterpolate)
%
% [poly] = tsgGetPolynomialSpaces(lGrid, bInterpolate)
%
% returns a matrix corresponding to the polynomial space that is integrated
% or interpolated exactly
%
% NOTE: this can be called only for global and sequence grids
%
% INPUT:
%
% lGrid: a grid list created by tsgMakeXXX(...)
%
% bInterpolate: (boolean)
% specifies whether to consider integration or interpolation
%
% OUTPUT:
%
% poly: (matrix of size num_polynomial_basis_functions X iDim)
% The polynomial space is
% span{ x.^poly(i,:) }, for x in R^d and i = 1 ... size(poly, 1)
%
[sFiles, sTasGrid] = tsgGetPaths();
[sFileG, sFileX, sFileV, sFileO, sFileW, sFileC] = tsgMakeFilenames(lGrid);
sCommand = [sTasGrid,' -getpoly'];
sCommand = [sCommand, ' -gridfile ', sFileG];
if (bInterpolate)
sCommand = [sCommand, ' -type iptotal'];
else
sCommand = [sCommand, ' -type qptotal'];
end
sCommand = [sCommand, ' -of ',sFileO];
lClean.sFileO = 1;
[status, cmdout] = system(sCommand);
if (max(size(strfind(cmdout, 'ERROR'))) ~= 0)
disp(cmdout);
error('The tasgrid execurable returned an error, see above');
return;
else
if (~isempty(cmdout))
fprintf(1,['WARNING: Command had non-empty output:\n']);
disp(cmdout);
end
[poly] = tsgReadMatrix(sFileO);
end
tsgCleanTempFiles(lGrid, lClean);
end
|