Category "multidimensional-array"

How does the axis parameter from NumPy work?

Can someone explain exactly what the axis parameter in NumPy does? I am terribly confused. I'm trying to use the function myArray.sum(axis=num) At first I t

Selecting From multidimensional Numpy array with multidimensional mask

I am trying to build an example to understand image segmentation, you are given an image of shape (1,2,2,3) it's a 2x2 image where each pixel has 3 numbers indi

stack smashing detected when trying to get to typedef two dinatial array that the adress store inside struct

i have this typedef of two dinantial array, and strust the keep his adress typedef double mat[MAT_SIZE][MAT_SIZE]; typedef struct matList { char *name;

find unique lists inside another list in an efficient way

solution = [[1,0,0],[0,1,0], [1,0,0], [1,0,0]] I have the above nested list, which contain some other lists inside it, how do we need to get the unique lists i

How to change array rows places whithouth numpy

Hello everyone here is my code: n =[[34,2,55,24,22],[31,22,4,7,333],[87,74,44,12,48]] for r in n: for c in r: print(c,end = " ") print() sums=[]

concatenate arrays of different lengths into one multidimensional array

I know that you cant stack or concatenate arrays of different lenghths in NumPy as all matrices need to be rectangular, but is there any other way to achieve th

How to use dynamic 2d array inside a struct array in C?

What do I want to do? I'm working on a project on dynamic matrix multiplication. I want to input from the user that on how many matrices, he/she wants to perfor

Passing and Returning a 2D array of unknown size in C++

I want to pass and return a 2D array of unknown size but I donot know how to do it. I know how to only return array of unknown size only (array of pointers). I

Group data in a multidimensional array based on two columns

I have an indexed array of associative arrays like this: [ ['brand' => 'ABC', 'model' => 'xyz', 'size' => 13], ['brand' => 'QWE', 'model' =&

Transpose multidimensional array and join values with commas

How to group by comma of every value as per same key? I need to re-orientate the array so that rows become columns and the new rows need to be joined together

Extracting multiple sets of rows/ columns from a 2D numpy array

I have a 2D numpy array from which I want to extract multiple sets of rows/ columns. # img is 2D array img = np.arange(25).reshape(5,5) array([[ 0, 1, 2, 3,

Using array_intersect on a multi-dimensional array

I have two arrays that both look like this: Array ( [0] => Array ( [name] => STRING [value] => STRING )

How to loop a tree array with unknown depth and get array blocks?

I found this solution to loop and print an unknown depth array: printAllValues($arr); function printAllValues($arr) { if(!is_array($arr)) {

PyTorch torch.max over multiple dimensions

Have tensor like :x.shape = [3, 2, 2]. import torch x = torch.tensor([ [[-0.3000, -0.2926],[-0.2705, -0.2632]], [[-0.1821, -0.1747],[-0.1526, -0.1453]

How to select top level columns in multi header pandas dataframe

I have a multi header dataframe and it looks like that: SPY ARKW Open Hig

PHP: set a (deep) array key from an array [closed]

is there a PHP function that would create a (deep) array key from an array ? It's quite difficult to explain, see that example: function myst

How to find or count the duplicate in multidimensional array in c# [closed]

I am creating a 2d (3 * 3) array in c# which has to count or find the duplicate value int[,] arr = new int[3, 3] { {1, 2, 6}, {4, 1, 5}

Can numpy.tensordot or ufunc replace this nested for loop?

Note: I know this is very similar to Use numpy.tensordot to replace a nested loop , only that the actual instance we are working on seemed different( I need qua

Perl: Multidimentional arrays and "experimental push" error

I'm a junior perl programmer and have very little experience with multidimentional arrays. I'm not even sure it is the proper data structure for this project. I

Sum column values from multiple arrays

I have an arrays with dynamic name. My array could be more than 3, depends and array variable should be unique $loopThrice = 3; $getSum = 0; $total = array();