|
10 | 10 | ######################################################################################################################## |
11 | 11 | # IMPORT |
12 | 12 | ######################################################################################################################## |
13 | | -import numpy as np |
| 13 | + |
14 | 14 | import ctypes |
| 15 | +import logging |
| 16 | +import sys |
15 | 17 | from collections import deque |
16 | | -from khiva.library import KhivaLibrary |
17 | 18 | from enum import Enum |
| 19 | + |
| 20 | +import numpy as np |
18 | 21 | import pandas as pd |
19 | | -import logging |
20 | | -import sys |
| 22 | + |
| 23 | +from khiva.library import KhivaLibrary |
21 | 24 |
|
22 | 25 |
|
23 | 26 | ######################################################################################################################## |
@@ -159,7 +162,8 @@ def from_arrayfire(cls, arrayfire): |
159 | 162 | """ |
160 | 163 | result = ctypes.c_void_p(0) |
161 | 164 | KhivaLibrary().c_khiva_library.from_arrayfire(ctypes.pointer(arrayfire.arr), ctypes.pointer(result)) |
162 | | - return cls(array_reference=result, arrayfire_reference=True) |
| 165 | + arrayfire.arr.value = 0 |
| 166 | + return cls(array_reference=result, arrayfire_reference=False) |
163 | 167 |
|
164 | 168 | def _create_array(self, data): |
165 | 169 | """ Creates the KHIVA array in the device. |
@@ -306,10 +310,24 @@ def to_pandas(self): |
306 | 310 |
|
307 | 311 | def display(self): |
308 | 312 | """ |
309 | | - Dispays the data stored in the KHIVA array. |
| 313 | + Displays the data stored in the KHIVA array. |
310 | 314 | """ |
311 | 315 | KhivaLibrary().c_khiva_library.display(ctypes.pointer(self.arr_reference)) |
312 | 316 |
|
| 317 | + def join(self, dim, other): |
| 318 | + """ |
| 319 | + Joins the first and second KHIVA arrays along the specified dimension. |
| 320 | + :param dim: The dimension along which the join occurs. |
| 321 | + :param other: The second input array. |
| 322 | + :return: KHIVA Array with the result of this operation. |
| 323 | + """ |
| 324 | + result = ctypes.c_void_p(0) |
| 325 | + KhivaLibrary().c_khiva_library.join(ctypes.pointer(ctypes.c_int(dim)), |
| 326 | + ctypes.pointer(self.arr_reference), |
| 327 | + ctypes.pointer(other.arr_reference), |
| 328 | + ctypes.pointer(result)) |
| 329 | + return Array(array_reference=result) |
| 330 | + |
313 | 331 | def __len__(self): |
314 | 332 | """ |
315 | 333 | Return the length. |
|
0 commit comments