Functions arrayfun and roots with GPU computing

조회 수: 8 (최근 30일)
Dave
Dave 2017년 2월 2일
댓글: Dave 2017년 2월 3일
Hi guys, I would like to compute the roots of N 8th order polynomials using the matlab function roots. I also would like to accomplish this task by taking advantage of GPU computing.
I've tried doing so with the following code:
rts_GPU=arrayfun(@(c4,c0) roots([C8,0,0,0,c4,0,0,0,c0]),aC4,aC0);
Where
  • C8 is constant
  • aC4 and aC0 are column vectors (created on the GPU) containing the coefficients associated to x^4 and x^0
But I get the following error:
Error using gpuArray/arrayfun
Function passed as first input argument contains unsupported or unknown function 'roots'.
But it is not true that the function "roots" it is not supported. Anyway, the code runs fine if aC4 and aC0 are not created on the GPU and 'UniformOutput' is set to false.
Maybe arrayfun is not even the right "tool" to do this, does anyone know how to solve this problem? Thanks in advance

채택된 답변

Edric Ellis
Edric Ellis 2017년 2월 3일
The list of functions supported for use with gpuArray arrayfun is here. Unfortunately, roots is not supported for gpuArray arrayfun.
  댓글 수: 1
Dave
Dave 2017년 2월 3일
Ok I was wrong, I was looking at the list of functions that supported gpuArray input arguments. Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 GPU Computing in MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by