Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions sparsediffpy/_bindings/atoms/atan.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#ifndef ATOM_ATAN_H
#define ATOM_ATAN_H

#include "common.h"
#include "elementwise_full_dom.h"

static PyObject *py_make_atan(PyObject *self, PyObject *args)
{
PyObject *child_capsule;
if (!PyArg_ParseTuple(args, "O", &child_capsule))
{
return NULL;
}
expr *child = (expr *) PyCapsule_GetPointer(child_capsule, EXPR_CAPSULE_NAME);
if (!child)
{
PyErr_SetString(PyExc_ValueError, "invalid child capsule");
return NULL;
}

expr *node = new_atan(child);
if (!node)
{
PyErr_SetString(PyExc_RuntimeError, "failed to create atan node");
return NULL;
}
expr_retain(node); /* Capsule owns a reference */
return PyCapsule_New(node, EXPR_CAPSULE_NAME, expr_capsule_destructor);
}

#endif /* ATOM_ATAN_H */
2 changes: 2 additions & 0 deletions sparsediffpy/_bindings/bindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/* Include atom bindings */
#include "atoms/add.h"
#include "atoms/asinh.h"
#include "atoms/atan.h"
#include "atoms/atanh.h"
#include "atoms/broadcast.h"
#include "atoms/convolve.h"
Expand Down Expand Up @@ -119,6 +120,7 @@ static PyMethodDef DNLPMethods[] = {
{"make_sinh", py_make_sinh, METH_VARARGS, "Create sinh node"},
{"make_tanh", py_make_tanh, METH_VARARGS, "Create tanh node"},
{"make_asinh", py_make_asinh, METH_VARARGS, "Create asinh node"},
{"make_atan", py_make_atan, METH_VARARGS, "Create atan node"},
{"make_atanh", py_make_atanh, METH_VARARGS, "Create atanh node"},
{"make_upper_tri", py_make_upper_tri, METH_VARARGS, "Create upper_tri node"},
{"make_broadcast", py_make_broadcast, METH_VARARGS, "Create broadcast node"},
Expand Down
Loading