diff --git a/+misc/+fundamentalMatrix/rudolphWoittennekNumeric.m b/+misc/+fundamentalMatrix/rudolphWoittennekNumeric.m index c8693e71665082f41a08618b68fc901d5c0eb55e..678f402c652f401aab1b67bd5c3e6a9710e30e81 100644 --- a/+misc/+fundamentalMatrix/rudolphWoittennekNumeric.m +++ b/+misc/+fundamentalMatrix/rudolphWoittennekNumeric.m @@ -7,7 +7,7 @@ function [Phi, Psi] = rudolphWoittennekNumeric(A, N, B, z) % spatial discretization points, n is the number of the states and d is the % degree of the operator. -Nz = A.gridSize; +Nz = [A(1).domain.n]; n = size(A, 2); m = size(B, 2); d = size(A, 3); % As order of a polynom is zero based diff --git a/+misc/functionArguments.m b/+misc/functionArguments.m index 477dacc44905baa035e7936cb69dd7f593eb0da9..884137ebf9db2e9695c5f8d8f061128c80048e4c 100644 --- a/+misc/functionArguments.m +++ b/+misc/functionArguments.m @@ -2,7 +2,13 @@ function names = functionArguments(func) %FUNCTIONARGUMENTS extracts the arguments of a function handle % names = misc.functionArguments(func) returns the arguments of the function handle func as the % string array names +%% Example +% names = functionArguments(@(z, zeta, t) z*zeta+t) + +names = split(string(regexp(func2str(func), "(?<=@\().*(?=\))", "match")), ","); functionArguments = extractBetween(func2str(func), "@(", ")"); names = split(string(functionArguments), ","); + + end diff --git a/+quantity/Discrete.m b/+quantity/Discrete.m index 6427a2eb7d83312cd3d4874b4f94fc037f6943e9..ccdd429774043bae0525a6f5d5eaf484abacd9ac 100644 --- a/+quantity/Discrete.m +++ b/+quantity/Discrete.m @@ -1148,21 +1148,6 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ... d = d(1); end - function s = gridSize(obj, myGridName) - % GRIDSIZE returns the size of all grid entries. - % todo: this should be called gridLength - warning('DEPRICATED: use quantity.Domain.gridLength method instead') - if isempty(obj(1).domain) - s = []; - else - if nargin == 1 - s = cellfun('length', obj(1).grid); - elseif nargin == 2 - s = cellfun('length', obj(1).gridOf(myGridName)); - end - end - end - function H = plot(obj, varargin) H = []; p = misc.Parser(); @@ -1995,37 +1980,8 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ... else error('Not yet implemented') end - end + end % rdivide() - function P = matTimes(a, b) - - assert(size(a,2) == size(b,1)); - - p = a(1).gridSize(); - q = p(2); - p = p(1); - obj = a.on(); - B = b.on(); - - % dimensions - n = size(a, 1); - m = size(b, 2); - o = size(b, 1); - - P = zeros(p, q, n, m); - - for k = 1 : n % rows of P - for l = 1 : m % columns of P - for r = 1 : o % rows of B or columns of A - P(:, :, k, l) = P( :, :, k, l ) + obj( :, :, k, r) .* B( :, :, r, l ); - end - end - end - - objOptArgs = a(1).optArgList(); - P = quantity.Discrete(quantity.Discrete.value2cell(P, [p, q], [n, m]), a(1).domain,... - objOptArgs{:}); - end function empty = isempty(obj) % ISEMPTY checks if the quantity object is empty % empty = isempty(obj) @@ -2095,43 +2051,6 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ... end end % iszero() - function P = ztzTimes(a, b) - - assert(size(a,2) == size(b,1)) - - p = a(1).gridSize(); - q = b(1).gridSize(); - - assert(p(1) == q(1)); - assert(numel(p) == 2); - assert(numel(q) == 1); - q = p(2); - p = p(1); - - obj = a.on(); - B = repmat(b.on(), 1, 1, 1, q); - B = permute(B, [1, 4, 2, 3]); - - % dimensions - n = size(a, 1); - m = size(b, 2); - o = size(b, 1); - - P = zeros(p, q, n, m); - - for k = 1 : n % rows of P - for l = 1 : m % columns of P - for r = 1 : o % rows of B or columns of A - P(:, :, k, l) = P( :, :, k, l ) + obj( :, :, k, r) .* B( :, :, r, l ); - end - end - end - - objOptArgList = a(1).optArgList(); - P = quantity.Discrete(quantity.Discrete.value2cell(P, [p, q], [n, m]), a(1).domain, ... - objOptArgList{:}); - end - function myGrid = gridOf(obj, myGridName) if ~iscell(myGridName) gridIdx = obj(1).domain.gridIndex(myGridName); diff --git a/+signals/PolynomialOperator.m b/+signals/PolynomialOperator.m index 1558cb401cdee65e5d03ded4a173bc97c8b27d16..5e53bb34b25d7c32ca8c7d4803b197badb6a775c 100644 --- a/+signals/PolynomialOperator.m +++ b/+signals/PolynomialOperator.m @@ -93,9 +93,6 @@ classdef PolynomialOperator < handle & matlab.mixin.Copyable function n = get.gridName(obj) n = obj.coefficient.gridName; end - function s = gridSize(obj, varargin) - s = obj(1).coefficient.gridSize(varargin{:}); - end function I = int(obj, varargin) II = cell(size(obj,1), 1); diff --git a/+unittests/+quantity/testDiscrete.m b/+unittests/+quantity/testDiscrete.m index 881c204ce2930cbada25b79a5b1fda1cc95c823b..652a87fa96875c7bb50c43b352bf80b44ac207cf 100644 --- a/+unittests/+quantity/testDiscrete.m +++ b/+unittests/+quantity/testDiscrete.m @@ -358,11 +358,8 @@ q = quantity.Discrete(sin(t) .* cos(t'), [domA, domB]); q1V = q.valueDiscrete; -q2V = q.sort('descend').valueDiscrete; - -tc.verifyEqual(q1V , q2V') - - +q.sort('descend'); +q2V = q.sort('descend').valueDiscrete;tc.verifyEqual(q1V , q2V.') end % testSort function testBlkdiag(tc)