Skip to content

Commit

Permalink
Merge branch 'master' into keepdims
Browse files Browse the repository at this point in the history
  • Loading branch information
v923z authored Dec 30, 2024
2 parents 0c8c5f0 + 73ed8cc commit 774b821
Show file tree
Hide file tree
Showing 8 changed files with 1,305 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/micropython.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
USERMODULES_DIR := $(USERMOD_DIR)

# Add all C files to SRC_USERMOD.
SRC_USERMOD += $(USERMODULES_DIR)/scipy/integrate/integrate.c
SRC_USERMOD += $(USERMODULES_DIR)/scipy/linalg/linalg.c
SRC_USERMOD += $(USERMODULES_DIR)/scipy/optimize/optimize.c
SRC_USERMOD += $(USERMODULES_DIR)/scipy/signal/signal.c
Expand Down
701 changes: 701 additions & 0 deletions code/scipy/integrate/integrate.c

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions code/scipy/integrate/integrate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

/*
* This file is part of the micropython-ulab project,
*
* https://github.com/v923z/micropython-ulab
*
* The MIT License (MIT)
*
* Copyright (c) 2024 Harald Milz <[email protected]>
*
*/

#ifndef _SCIPY_INTEGRATE_
#define _SCIPY_INTEGRATE_

#include "../../ulab_tools.h"

extern const mp_obj_module_t ulab_scipy_integrate_module;

#if ULAB_INTEGRATE_HAS_TANHSINH
MP_DECLARE_CONST_FUN_OBJ_KW(optimize_tanhsinh_obj);
#endif
#if ULAB_INTEGRATE_HAS_ROMBERG
MP_DECLARE_CONST_FUN_OBJ_KW(optimize_romberg_obj);
#endif
#if ULAB_INTEGRATE_HAS_SIMPSON
MP_DECLARE_CONST_FUN_OBJ_KW(optimize_simpson_obj);
#endif
#if ULAB_INTEGRATE_HAS_QUAD
MP_DECLARE_CONST_FUN_OBJ_KW(optimize_quad_obj);
#endif

#endif /* _SCIPY_INTEGRATE_ */

6 changes: 5 additions & 1 deletion code/scipy/scipy.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
* This file is part of the micropython-ulab project,
*
Expand All @@ -20,6 +19,8 @@
#include "signal/signal.h"
#include "special/special.h"
#include "linalg/linalg.h"
#include "integrate/integrate.h"


#if ULAB_HAS_SCIPY

Expand All @@ -28,6 +29,9 @@

static const mp_rom_map_elem_t ulab_scipy_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_scipy) },
#if ULAB_SCIPY_HAS_INTEGRATE_MODULE
{ MP_ROM_QSTR(MP_QSTR_integrate), MP_ROM_PTR(&ulab_scipy_integrate_module) },
#endif
#if ULAB_SCIPY_HAS_LINALG_MODULE
{ MP_ROM_QSTR(MP_QSTR_linalg), MP_ROM_PTR(&ulab_scipy_linalg_module) },
#endif
Expand Down
22 changes: 22 additions & 0 deletions code/ulab.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,28 @@
#define ULAB_NUMPY_HAS_WHERE (1)
#endif

// the integrate module; functions of the integrate module still have
// to be defined separately
#ifndef ULAB_SCIPY_HAS_INTEGRATE_MODULE
#define ULAB_SCIPY_HAS_INTEGRATE_MODULE (1)
#endif

#ifndef ULAB_INTEGRATE_HAS_TANHSINH
#define ULAB_INTEGRATE_HAS_TANHSINH (1)
#endif

#ifndef ULAB_INTEGRATE_HAS_ROMBERG
#define ULAB_INTEGRATE_HAS_ROMBERG (1)
#endif

#ifndef ULAB_INTEGRATE_HAS_SIMPSON
#define ULAB_INTEGRATE_HAS_SIMPSON (1)
#endif

#ifndef ULAB_INTEGRATE_HAS_QUAD
#define ULAB_INTEGRATE_HAS_QUAD (1)
#endif

// the linalg module; functions of the linalg module still have
// to be defined separately
#ifndef ULAB_NUMPY_HAS_LINALG_MODULE
Expand Down
Loading

0 comments on commit 774b821

Please sign in to comment.