function matchLatencies = getSubFilterMatchingLatencies(polynomialMatrix,cyclesPerSample)
    
    subFilterLatencies = getSubFilterLatencies(polynomialMatrix,cyclesPerSample);
    matchLatencies = max(subFilterLatencies)*ones(size(subFilterLatencies))-subFilterLatencies;
    
end

function subFilterLatencies = getSubFilterLatencies(A,cyclesPerSample)
    
    numSubFilts = size(A,1);
    
    subFilterLatencies = zeros(numSubFilts,1);
    
    for k=1:size(A,1)
        
        filt = dsp.HDLFIRFilter(...
            'Numerator', A(k,:), ...
            'FilterStructure', 'Partly serial systolic', ...
            'CoefficientsDataType', 'Same word length as input', ...
            'SerializationOption', 'Minimum number of cycles between valid input samples', ...
            'NumberOfCycles', cyclesPerSample);
        
        subFilterLatencies(k) = filt.getLatency(numerictype(1,16,15));
        
    end
    
end
