Implement NumPy math functions #339
No reviewers
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#339
Loading…
Reference in New Issue
No description provided.
Delete Branch "issue-149"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements NumPy math functions from ARTIQ for doubles.
Part of #149
37fe208c33
toeaac49270b
eaac49270b
to278cfd309d
278cfd309d
toce5ce027df
ce5ce027df
toded31e64ef
WIP: Implement NumPy math functionsto Implement NumPy math functionsded31e64ef
toad1f0abb55
v2: Rebased against
master
ad1f0abb55
to157854e71f
v3: Rebased against
master
@ -0,0 +15,4 @@
...
def dbl_pi() -> float:
return 3.1415926535897932384626433
Please use the same indentation as the other files.
@ -435,0 +439,4 @@
generator: &dyn CodeGenerator,
ctx: &CodeGenContext<'ctx, 'a>,
v: FloatValue<'ctx>,
to_i1: bool,
to_i1 sounds a bit ad-hoc and out of place. Can't the caller itself convert as needed?
@ -435,0 +464,4 @@
generator: &dyn CodeGenerator,
ctx: &CodeGenContext<'ctx, 'a>,
v: FloatValue<'ctx>,
to_i1: bool,
same here
@ -86,6 +98,48 @@ def patch(module):
module.Some = Some
module.none = none
# NumPy math functions
Fix the indentation
Some of those are actually Scipy. Edit the comments/naming accordingly (as in the legacy compiler).
157854e71f
to86379c8b40
@ -140,0 +140,4 @@
}
int32_t __nac3_isinf(double x) {
return __builtin_isinf(x);
Please use the same indentation as the rest of that file.
86379c8b40
to1927035cfc
1927035cfc
to0818f5804e
v4: Rebased against master
v5, v6: Fix indentation and remove
to_i1
fromisnan
andisinf
0818f5804e
tobc692aaaf5
v7: Rebased against mater
@ -435,0 +450,4 @@
.into_int_value()
}
/// Generates a call to `isnan` in IR. Returns either an `i32` representing the result.
either?
Also I thought we used i1 and i8 for booleans. Why i32 now?
This is not written anywhere in GCC's Manual or Clang's Manual, but testing it using the following program shows that the return type of both
isinf
andisnan
isint
:However, the C++ version (
std::isinf
andstd::isnan
) returns abool
instead, so maybe we can coerce it before passing back to the caller.This is an internal NAC3 function and I think it should follow NAC3 conventions?
bc692aaaf5
to7966535677
v8: Fixed incorrect docstring.
7966535677
to2e1d6ab644
2e1d6ab644
to7e4dab15ae
v9: Updated
isinf
andisnan
to returni1
v10: Rebased against master