Commit ce85800b authored by Ferdinand Fischer's avatar Ferdinand Fischer
Browse files

quantity.Discrete/compose can handle matrix valued quantities now

parent 30912ee9
......@@ -266,6 +266,16 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
myCompositionDomain = optionalArgs.domain;
originalDomain = obj(1).domain;
% quick workaround to apply to marix valued quantities
if numel(obj) > 1
optArgs = misc.struct2namevaluepair( optionalArgs );
for k = 1:numel(obj)
obj_hat(k) = compose(obj(k), g, optArgs{:});
end
obj_hat = reshape(obj_hat, size(obj));
return
end
assert( length( myCompositionDomain ) == 1 );
[idx, logOfDomain] = originalDomain.gridIndex(myCompositionDomain);
assert( isequal( originalDomain(idx), myCompositionDomain ), ...
......
......@@ -76,6 +76,16 @@ fog = f.compose(g, 'domain', tau);
FoG = quantity.Discrete( 2 * z.grid + t.grid', 'domain', [z, t]);
testCase.verifyEqual( fog.on, FoG.on, 'AbsTol', 5e-16)
% verify the matrix valued case
% #TODO: by this, an object array can be created where different quantities
% with different grids respectively empty quantities are in the same
% matrix.
M(1:2,1:2) = f;
Mog = M.compose(g, 'domain', tau);
MoG(1:2, 1:2) = FoG;
testCase.verifyEqual( MoG.on, MoG.on, 'AbsTol', 5e-16)
end
function testCastDiscrete2Function(testCase)
......
......@@ -184,9 +184,9 @@ end
function testDet(testCase)
% test the det of OP via the characteristic polynomial of a matrix A
% det(sI - A) = det(OP)
% det(sI - A) = det(OP) = det( -A + sI )
A = [0 -1; 1 0];
OP = signals.PolynomialOperator( {-A, [1 0; 0 1]} );
OP = signals.PolynomialOperator( {-A, eye(2)} );
d1 = det(OP);
testCase.verifyEqual( charpoly([0 -1; 1 0]), double( [d1.coefficient] ) );
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment