Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

scipy.sparse.linalg._svdp signature mismatch #3380

Open
lesteve opened this issue Dec 21, 2022 · 1 comment 路 May be fixed by #3381
Open

scipy.sparse.linalg._svdp signature mismatch #3380

lesteve opened this issue Dec 21, 2022 · 1 comment 路 May be fixed by #3381
Labels
bug Something isn't working scipy

Comments

@lesteve
Copy link
Contributor

lesteve commented Dec 21, 2022

馃悰 Bug

To Reproduce

import numpy as np
from scipy.sparse.linalg._svdp import _svdp

np.random.seed(0)
n, k = 70, 10
A = np.random.random((n, n))
_svdp(A, k, kmax=5*k)

Stack-trace with debug symbols:

Uncaught RuntimeError: null function or function signature mismatch
    at dgetu0_ (00055cfe:0x9d7e)
    at dlanbpro_ (00055cfe:0xd2b2)
    at dlansvd_irl__ (00055cfe:0xa19e)
    at dynCall (pyodide.asm.js:16146:40)
    at pyodide.asm.js:16154:18
    at stubs.<computed> (pyodide.asm.js:16567:33)
    at f2py_rout__dpropack_dlansvd_irl (00055cfe:0x75a7)
    at fortran_call (0003e3ba:0x6642)
    at _PyObject_Call (pyodide.asm.wasm:0x131064)
    at PyObject_Call (pyodide.asm.wasm:0x13109d)

Debugging with Chromium, the function is called with 7 arguments with a i32 return type:

call_indirect (param i32 i32 i32 i32 i32 i32 i32) (result i32)

but wasm functions has 8 arguments and returns f32

(func $cb_daprod_in___user__routines (;111;) (param $var0 i32) (param $var1 i32) (param $var2 i32) (param $var3 i32) (param $var4 i32) (param $var5 i32) (param $var6 i32) (param $var7 i32) (result f32)

Not sure where this comes from ...

Expected behavior

No error

Environment

  • Pyodide Version: both stable (0.21.3) and latest
  • Browser version: not relevant
  • Any other relevant information:

Additional context

Bumped into this when looking at scipy.sparse test suite issues in lesteve/scipy-tests-pyodide#3

@lesteve lesteve added the bug Something isn't working label Dec 21, 2022
@hoodmane
Copy link
Member

Thanks for the report! Well the mismatch in the number of arguments is due to the extra ftnlen inserted by f2c. The following patch should fix it:

--- a/scipy/sparse/linalg/_propack/dpropack.pyf
+++ b/scipy/sparse/linalg/_propack/dpropack.pyf
@@ -3,7 +3,7 @@
 python module __user__routines
     interface
         function daprod(transa,m,n,x,y,dparm,iparm)
-           character*1 :: transa
+           integer :: transa
            integer intent(in) :: m
            integer intent(in) :: n
            double precision depend(m,n),check(len(x)>=(transa[0] == 'n' ? n : m)),dimension((transa[0] == 'n' ? n : m)) :: x

About the return type, I'm not sure yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scipy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants