컴퓨터과학

numpy.vectorize 함수

홈카페주인 2023. 10. 5. 16:51

중첩된 객체의 sequence 혹은 numpy array 를 입력으로 받고 numpy array 혹은 numpy array 의 tuple 을 반환하는 벡터화된 함수를 정의하여 사용한다. 

 

Note.

vectorize 함수는 성능이 아니라 편의를 위해 제공된 함수이다. 구현은 기본적으로 for 루프이다. 

 

참고자료

numpy document : https://numpy.org/doc/stable/reference/generated/numpy.vectorize.html

 

numpy.vectorize — NumPy v1.26 Manual

Generalized universal function signature, e.g., (m,n),(n)->(m) for vectorized matrix-vector multiplication. If provided, pyfunc will be called with (and expected to return) arrays with shapes given by the size of corresponding core dimensions. By default,

numpy.org

 

728x90