Сигнатура функции:
def SLBQP(Q, q, u, a, x, eps=1e-6, maxIter=1000):
и она возвращает float64.
Типы аргументов:
Q -- np.array([[1., 2.], [4., 5.]])
q -- np.array([1.,2.,3.,4.])
u -- a scalar
a -- np.array([1.,2.,3.,4.])
x -- np.array([1.,2.,3.,4.])
Я пытался
@jit('f8(f8[:,:], f8[:], f8, f8[:], f8[:], f8, i4)',nopython=True)
def SLBQP(Q, q, u, a, x, eps=1e-6, maxIter=1000):
, и это дает мне эту ошибку:
Invalid use of Function(<built-in function array>) with argument(s) of type(s): (array(float64, 1d, C))
* parameterized
In definition 0:
TypingError: array(float64, 1d, C) not allowed in a homogeneous sequence
raised from /Users/gerardozinno/Desktop/ProgettoML/venv/lib/python3.8/site-packages/numba/typing/npydecl.py:472
In definition 1:
TypingError: array(float64, 1d, C) not allowed in a homogeneous sequence
raised from /Users/gerardozinno/Desktop/ProgettoML/venv/lib/python3.8/site-packages/numba/typing/npydecl.py:472
Я также попробовал это:
@jit('numba.float64(numba.array(float64, 2d, C), numba.array(float64, 1d, C), numba.float64, numba.array(float64, 1d, C), numba.array(float64, 1d, C), numba.float64, numba.int64)',nopython=True)
, и это дает мне синтаксическую ошибку.
РЕДАКТИРОВАТЬ:
Я пытался с этой подписью:
@nb.njit('f8(f8[:,:], f8[:], f8, f8[:], f8[:], f8, i4)')
, предложенный Тане Брукером в разделе ответов, и это дает мне эту ошибку:
Invalid use of Function(<built-in function array>) with argument(s) of type(s): (array(float64, 1d, C))
* parameterized
In definition 0:
TypingError: array(float64, 1d, C) not allowed in a homogeneous sequence
raised from /Users/gerardozinno/Desktop/ProgettoML/venv/lib/python3.8/site-packages/numba/typing/npydecl.py:472
In definition 1:
TypingError: array(float64, 1d, C) not allowed in a homogeneous sequence
raised from /Users/gerardozinno/Desktop/ProgettoML/venv/lib/python3.8/site-packages/numba/typing/npydecl.py:472
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<built-in function array>)
[2] During: typing of call at /Users/gerardozinno/Desktop/NUOVO/ProgettoML/svr/SLBQP.py (119)
File "SLBQP.py", line 119:
def SLBQP(Q, q, u, a, x, eps=1e-6, maxIter=1000):
<source elided>
v = np.dot(Qx,x) + np.dot(q, x)
g = np.array(Qx+q)
^