Skip to content

Commit 0df7d46

Browse files
committed
fix: remove usage of igraph_matrix_e now that it was removed from igraph itself
1 parent 8e04cfe commit 0df7d46

File tree

3 files changed

+3
-39
lines changed

3 files changed

+3
-39
lines changed

src/codegen/internal_lib.py.in

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,6 @@ igraph_matrix_nrow = _lib.igraph_matrix_nrow
336336
igraph_matrix_nrow.restype = igraph_integer_t
337337
igraph_matrix_nrow.argtypes = [POINTER(igraph_matrix_t)]
338338

339-
igraph_matrix_e = _lib.igraph_matrix_e
340-
igraph_matrix_e.restype = igraph_real_t
341-
igraph_matrix_e.argtypes = [POINTER(igraph_matrix_t), igraph_integer_t, igraph_integer_t]
342-
343-
igraph_matrix_e_ptr = _lib.igraph_matrix_e_ptr
344-
igraph_matrix_e_ptr.restype = POINTER(igraph_real_t)
345-
igraph_matrix_e_ptr.argtypes = [POINTER(igraph_matrix_t), igraph_integer_t, igraph_integer_t]
346-
347339
# Integer matrix type
348340

349341
igraph_matrix_int_init = _lib.igraph_matrix_int_init
@@ -385,14 +377,6 @@ igraph_matrix_int_nrow = _lib.igraph_matrix_int_nrow
385377
igraph_matrix_int_nrow.restype = igraph_integer_t
386378
igraph_matrix_int_nrow.argtypes = [POINTER(igraph_matrix_int_t)]
387379

388-
igraph_matrix_int_e = _lib.igraph_matrix_int_e
389-
igraph_matrix_int_e.restype = igraph_integer_t
390-
igraph_matrix_int_e.argtypes = [POINTER(igraph_matrix_int_t), igraph_integer_t, igraph_integer_t]
391-
392-
igraph_matrix_int_e_ptr = _lib.igraph_matrix_int_e_ptr
393-
igraph_matrix_int_e_ptr.restype = POINTER(igraph_integer_t)
394-
igraph_matrix_int_e_ptr.argtypes = [POINTER(igraph_matrix_int_t), igraph_integer_t, igraph_integer_t]
395-
396380
# List of vectors type
397381

398382
igraph_vector_list_init = _lib.igraph_vector_list_init

src/igraph_ctypes/_internal/conversion.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66

77
from contextlib import contextmanager
8-
from ctypes import addressof, cast, get_errno, memmove, POINTER
8+
from ctypes import addressof, get_errno, memmove, POINTER
99
from os import strerror
1010
from typing import (
1111
Any,
@@ -32,11 +32,9 @@
3232
igraph_matrix_int_init_array,
3333
igraph_matrix_int_ncol,
3434
igraph_matrix_int_nrow,
35-
igraph_matrix_int_e_ptr,
3635
igraph_matrix_init_array,
3736
igraph_matrix_ncol,
3837
igraph_matrix_nrow,
39-
igraph_matrix_e_ptr,
4038
igraph_vector_bool_get,
4139
igraph_vector_bool_get_ptr,
4240
igraph_vector_bool_init_array,
@@ -824,17 +822,15 @@ def igraph_matrix_t_to_numpy_array(matrix: _Matrix) -> RealArray:
824822
shape = igraph_matrix_nrow(matrix), igraph_matrix_ncol(matrix)
825823
result = np.zeros(shape, dtype=np_type_of_igraph_real_t)
826824
if result.size > 0:
827-
memmove(result.ctypes.data, igraph_matrix_e_ptr(matrix, 0, 0), result.nbytes)
825+
memmove(result.ctypes.data, matrix.unwrap().data.stor_begin, result.nbytes)
828826
return result
829827

830828

831829
def igraph_matrix_int_t_to_numpy_array(matrix: _MatrixInt) -> IntArray:
832830
shape = igraph_matrix_int_nrow(matrix), igraph_matrix_int_ncol(matrix)
833831
result = np.zeros(shape, dtype=np_type_of_igraph_integer_t)
834832
if result.size > 0:
835-
memmove(
836-
result.ctypes.data, igraph_matrix_int_e_ptr(matrix, 0, 0), result.nbytes
837-
)
833+
memmove(result.ctypes.data, matrix.unwrap().data.stor_begin, result.nbytes)
838834
return result
839835

840836

src/igraph_ctypes/_internal/lib.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,6 @@ def _load_libc():
336336
igraph_matrix_nrow.restype = igraph_integer_t
337337
igraph_matrix_nrow.argtypes = [POINTER(igraph_matrix_t)]
338338

339-
igraph_matrix_e = _lib.igraph_matrix_e
340-
igraph_matrix_e.restype = igraph_real_t
341-
igraph_matrix_e.argtypes = [POINTER(igraph_matrix_t), igraph_integer_t, igraph_integer_t]
342-
343-
igraph_matrix_e_ptr = _lib.igraph_matrix_e_ptr
344-
igraph_matrix_e_ptr.restype = POINTER(igraph_real_t)
345-
igraph_matrix_e_ptr.argtypes = [POINTER(igraph_matrix_t), igraph_integer_t, igraph_integer_t]
346-
347339
# Integer matrix type
348340

349341
igraph_matrix_int_init = _lib.igraph_matrix_int_init
@@ -385,14 +377,6 @@ def _load_libc():
385377
igraph_matrix_int_nrow.restype = igraph_integer_t
386378
igraph_matrix_int_nrow.argtypes = [POINTER(igraph_matrix_int_t)]
387379

388-
igraph_matrix_int_e = _lib.igraph_matrix_int_e
389-
igraph_matrix_int_e.restype = igraph_integer_t
390-
igraph_matrix_int_e.argtypes = [POINTER(igraph_matrix_int_t), igraph_integer_t, igraph_integer_t]
391-
392-
igraph_matrix_int_e_ptr = _lib.igraph_matrix_int_e_ptr
393-
igraph_matrix_int_e_ptr.restype = POINTER(igraph_integer_t)
394-
igraph_matrix_int_e_ptr.argtypes = [POINTER(igraph_matrix_int_t), igraph_integer_t, igraph_integer_t]
395-
396380
# List of vectors type
397381

398382
igraph_vector_list_init = _lib.igraph_vector_list_init

0 commit comments

Comments
 (0)