gpuArray/filter doesn't support multi-channel lag terms?

It seems that the gpuArray implementation of the filter function doesn't support lag terms with multiple input channels.
For example, the cpu implementation works just fine:
B = 0.5;
A = [1, -0.5];
X = (randn(100,4));
Zi = X(1,:);
Y = filter(B, A , X , Zi);
However, Once I try the gpu implementation,
B = 0.5;
A = [1, -0.5];
X = gpuArray(randn(100,4));
Zi = X(1,:);
Y = filter(B, A , X , Zi);
I get the following error:
Error using gpuArray/filter
Initial conditions must be a vector of length
max(length(a),length(b))-1, or an array with the
leading dimension of size max(length(a),length(b))-1
and with remaining dimensions matching those of x.
Alternatively, the gpu approach does work with multiple channels if I insert [] for the lag term.
Any ideas?

 採用された回答

Joss Knight
Joss Knight 2017 年 7 月 4 日

0 投票

This is a bug that was fixed in R2016b, so you must have an earlier version of MATLAB. If you can't upgrade, you can avoid it by specifying more than 2 filter taps, or using the same initial condition for all inputs.
I believe you can get an identical answer by adding some additional zeros:
Y = filter(B, [A, 0] , X , [Zi; zeros(1,size(Zi,2))]);
This should avoid the problem.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeHolidays / Seasons についてさらに検索

質問済み:

2017 年 6 月 29 日

回答済み:

2017 年 7 月 4 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by