Skip to content

Commit a5d033e

Browse files
committed
conj & conjugate impl
1 parent e73f34f commit a5d033e

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

quaddtype/numpy_quaddtype/src/ops.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ quad_absolute(const Sleef_quad *op)
3737
return Sleef_fabsq1(*op);
3838
}
3939

40+
static inline Sleef_quad
41+
quad_conjugate(const Sleef_quad *op)
42+
{
43+
// For real numbers, conjugate is the identity function (no-op)
44+
return *op;
45+
}
46+
4047
static inline Sleef_quad
4148
quad_rint(const Sleef_quad *op)
4249
{
@@ -217,6 +224,13 @@ ld_absolute(const long double *op)
217224
return fabsl(*op);
218225
}
219226

227+
static inline long double
228+
ld_conjugate(const long double *op)
229+
{
230+
// For real numbers, conjugate is the identity function (no-op)
231+
return *op;
232+
}
233+
220234
static inline long double
221235
ld_sign(const long double *op)
222236
{

quaddtype/numpy_quaddtype/src/umath/unary_ops.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ init_quad_unary_ops(PyObject *numpy)
161161
if (create_quad_unary_ufunc<quad_absolute, ld_absolute>(numpy, "fabs") < 0) {
162162
return -1;
163163
}
164+
// conjugate is a no-op for real numbers (returns the value unchanged)
165+
if (create_quad_unary_ufunc<quad_conjugate, ld_conjugate>(numpy, "conjugate") < 0) {
166+
return -1;
167+
}
168+
// conj is an alias for conjugate, no need to register
164169
if (create_quad_unary_ufunc<quad_sign, ld_sign>(numpy, "sign") < 0) {
165170
return -1;
166171
}

quaddtype/release_tracker.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
| rint |||
2828
| sign |||
2929
| heaviside | | |
30-
| conj | | |
31-
| conjugate | | |
30+
| conj | | |
31+
| conjugate | | |
3232
| exp |||
3333
| exp2 |||
3434
| log |||

0 commit comments

Comments
 (0)