stan-dev / stan-dev/math

add sincos function

Open
#3,082 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Neither boost nor Eigen has a sincos function however Julia has a succinct implementation in C at https://github.com/JuliaLang/julia/blob/eabd0212ed974b7128ec77180424090edb4a6d04/base/fastmath.jl#L299. The code is MIT license that is compatible with ours.

A few questions:

  • Is it possible to add llvm code like this?
  • Do we want to?

The output from this function will be a tuple of whatever the input type was. So if the input is a real the output will be a tuple of reals. If the input is complex then this falls back to calculating sin and cos separately and returning a tuple of complex types.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Julia fastmath.jl implementation linked in the issue and reviewing how Stan Math exposes scalar and complex math functions. Clarify whether an LLVM-based implementation is wanted, then define completion as a sincos function returning a tuple matching the input type, with complex inputs using separate sine and cosine calculations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.