cornell-zhang/heterocl

How can I calculate atan2 with HeteroCL?

MariusWiggert opened this issue · 5 comments

This is probably a really dumb question but unfortunately I couldn't find an answer in the last hours.
Is there an easy way to calculate the atan with heterocl? I found the python API for sin, cos, tanh, but not atan.

Help is highly appreciated!

Marius

We don't have such API unfortunately. You will need to write your own function to calculate the (approximate) value of arctangent.

One way is to use Taylor series expansion. You may find this article useful.

Thanks for clarifying @seanlatias ! The article seems actually quite helpful. I found C implementations of arctan but they looked a lot more complicated with look up tables etc.

Is there a way to plug in a C++ or C implementation of arctan into heterocl?

Currently we don't have such a feature. We are also thinking about importing some existing C/C++ implementations into HCL, especially those more hardware-friendly ones.

Thanks! That helps, then I'll implement the arctan approximation on my own for now =)