David Mak
5839badadd
[standalone] Update globals.py with type-inferred global var
2024-10-07 20:44:08 +08:00
David Mak
581b2f7bb2
[standalone] Add demo for global variables
2024-10-04 13:24:30 +08:00
David Mak
3e92c491f5
[standalone] Add tests creating ndarrays with tuple dims
2024-09-11 15:52:43 +08:00
lyken
4318f8de84
standalone: improve src/assignment.py
2024-08-29 10:33:58 +08:00
abdul124
15e62f467e
standalone: add tests for polymorphism
2024-08-26 18:37:55 +08:00
David Mak
c5ae0e7c36
[standalone] Add tests for tuple equality
2024-08-21 16:25:32 +08:00
David Mak
b8dab6cf7c
[standalone] Add tests for string equality
2024-08-21 16:25:32 +08:00
lyken
8532bf5206
standalone: add missing test_ndarray_ceil() run
2024-08-21 11:39:00 +08:00
David Mak
d0da688aa7
standalone: Add tuple len test
2024-08-13 15:02:59 +08:00
David Mak
ac0d83ef98
standalone: Add vararg.py
2024-08-06 11:48:42 +08:00
lyken
fb9fe8edf2
core: reimplement assignment type inference and codegen
...
- distinguish between setitem and getitem
- allow starred assignment targets, but the assigned value would be a tuple
- allow both [...] and (...) to be target lists
2024-08-05 19:30:48 +08:00
abdul124
63d2b49b09
core: remove np_linalg_matmul
2024-08-05 11:44:55 +08:00
abdul124
1c72698d02
core: add np_linalg_det and np_linalg_matrix_power functions
2024-07-31 18:02:54 +08:00
abdul124
54f883f0a5
core: implement np_dot using LLVM_IR
2024-07-31 15:53:51 +08:00
abdul124
4a6845dac6
standalone: add np.transpose and np.reshape functions
2024-07-31 13:23:07 +08:00
abdul124
d6a4d0a634
standalone: add linalg methods and tests
2024-07-29 16:48:06 +08:00
abdul124
45e9360c4d
standalone: Add np_argmax and np_argmin tests
2024-07-12 18:19:56 +08:00
David Mak
25d2de67f7
standalone: Add output_range and tests
2024-07-09 04:44:40 +08:00
David Mak
9238a5e86e
standalone: Rename output_str to output_strln and add output_str
...
output_str is for outputting strings without newline, and the newly
introduced output_strln now has the old behavior of ending with a
newline.
2024-07-09 04:44:40 +08:00
David Mak
ba32fab374
standalone: Add demos for list arithmetic operators
2024-07-04 16:01:15 +08:00
abdul124
83154ef8e1
core/llvm_intrinsics: remove llvm.roundeven call from call_float_roundeven
2024-07-03 14:17:47 +08:00
lyken
5b11a1dbdd
core: support tuple and int32 input for np_empty, np_ones, and more
2024-06-27 14:30:17 +08:00
David Mak
5bade81ddb
standalone: Add test for multidim array index with one index
2024-06-20 12:50:30 +08:00
Sébastien Bourdeauducq
f00e458f60
add test for class without __init__
2024-06-19 18:16:54 +08:00
David Mak
53d44b9595
standalone: Add np_array tests
2024-06-11 16:44:36 +08:00
David Mak
23b2fee4e7
standalone: Add test case for ndarray slicing
2024-06-03 16:40:05 +08:00
David Mak
520e1adc56
core/builtins: Add np_minimum/np_maximum
2024-05-09 15:01:20 +08:00
David Mak
73e81259f3
core/builtins: Add np_min/np_max
2024-05-09 15:01:20 +08:00
David Mak
30c6cffbad
core/builtins: Refactored numpy builtins to accept scalar and ndarrays
2024-05-06 15:38:29 +08:00
David Mak
9566047241
standalone: Fix cbrt never tested
2024-05-06 13:21:54 +08:00
David Mak
847615fc2f
core: Implement numpy.matmul for 2D-2D ndarrays
2024-04-23 10:27:37 +08:00
David Mak
e0f440040c
core/expr: Implement negative indices for ndarray
2024-04-15 12:49:42 +08:00
David Mak
52c731c312
core: Implement Not/UAdd/USub for booleans
...
Not sure if this is deliberate or an oversight, but we implement it
anyway for consistency with other Python implementations.
2024-04-12 18:29:58 +08:00
David Mak
00d1b9be9b
core: Fix __inv__ for i8-based boolean operands
2024-04-12 15:35:54 +08:00
David Mak
a920fe0501
core: Implement elementwise comparison operators
2024-04-03 00:07:33 +08:00
David Mak
727a1886b3
core: Implement elementwise unary operators
2024-04-03 00:07:33 +08:00
David Mak
6af13a8261
core: Implement elementwise binary operators
...
Including immediate variants of these operators.
2024-04-03 00:07:33 +08:00
David Mak
2edc1de0b6
standalone: Update ndarray.py to output all elements in ndarrays
2024-03-07 14:59:13 +08:00
David Mak
96b7f29679
core: Implement `ndarray.fill`
2024-03-07 14:59:13 +08:00
David Mak
22e831cb76
core: Add test for indexing into ndarray
2024-02-19 17:13:10 +08:00
David Mak
5cecb2bb74
core: Fix Literal use in variable type annotation
2024-02-06 18:16:14 +08:00
David Mak
fef4b2a5ce
standalone: Disable tests requiring return of non-primitive values
2024-01-29 12:49:50 +08:00
David Mak
c679474f5c
standalone: Fix redefinition of ndarray consumer functions
2024-01-17 09:38:13 +08:00
David Mak
140f8f8a08
core: Implement most ndarray-creation functions
2023-12-22 16:29:55 +08:00
David Mak
27fcf8926e
core: Implement ndarray constructor and numpy.empty
2023-12-22 16:29:54 +08:00
David Mak
6dccb343bb
Revert "core: Do not keep unification result for function arguments"
...
This reverts commit f09f3c27a5
.
2023-12-18 10:01:23 +08:00
David Mak
f09f3c27a5
core: Do not keep unification result for function arguments
...
For some reason, when unifying a function call parameter with an
argument, subsequent calls to the same function will only accept the
type of the substituted argument.
This affect snippets like:
```
def make1() -> C[Literal[1]]:
return ...
def make2() -> C[Literal[2]]:
return ...
def consume(instance: C[Literal[1, 2]]):
pass
consume(make1())
consume(make2())
```
The last statement will result in a compiler error, as the parameter of
consume is replaced with C[Literal[1]].
We fix this by getting a snapshot before performing unification, and
restoring the snapshot after unification succeeds.
2023-12-16 18:40:48 +08:00
David Mak
457d3b6cd7
core: Refactor generic constants to `Literal`
...
Better matches the syntax of `typing.Literal`.
2023-12-16 18:40:48 +08:00
David Mak
031e660f18
core: Initial implementation for const generics
2023-12-08 18:02:11 +08:00
David Mak
68b97347b1
core: Infer builtins name list using builtin declaration list
2023-12-08 17:29:34 +08:00