0
votes
0answers
76 views

How to make a textBox value to a name of array variable?

I have some public array variables: double[,] matrikkookurensisub1_0 = new double[256, 256]; double[,] matrikkookurensisub1_45 = new double[256, 256]; double[,] matrikkookurensisub1_90 = new ...
1
vote
4answers
96 views

How to create a C++ bool 2D array with size 40,000?

I want to make a bool matrix named connectionsOf with size of up to 40 000. Here is my code: int index = 40000; bool connectionsOf[index][index]; However, when I run it on a file with 37 000 ...
1
vote
1answer
67 views

Selecting some dimensions from a multi-dimensional array

I have a 4-D array, and I need to process all 1-D vectors from this array along a given dimension. This works well: def myfun(arr4d,selected_dim): # selected_dim can only be 2 or 3 ...
-1
votes
2answers
76 views

How to access elements in double pointer style matrix

double **matrix = NULL; matrix = (double **)malloc(sizeof(double *) * N); // N is the size of the square matrix for(int i=0; i<N; i++) { matrix[i] = (double *)malloc(sizeof(double)*N); } // ...
5
votes
8answers
169 views

How to Convert int[] to int[,] - C#

I have an int array in one dimension: var intArray=new[] { 1, 2, 3, 4, 5, 6 }; and I want to convert it to two dimensions, such as: var intArray2D=new[,] { {1, 2}, {3, 4}, {5, 6} }; How do I ...
2
votes
2answers
106 views

NumPy: How to collapse N-dimensional array along a single dimension using argmin/max output?

Is there a straight-forward way to use the output of calling NumPy's argmax or argmin functions on a single dimension of an N-D array to define an index into that array? This is probably best ...
2
votes
2answers
34 views

Setting values in matrices - Python

I made i matrix 5x3 field = [] fields = [] for i in range(0,5): for j in range(0,3): x = 1 field.append(x) fields.append(field) When i want to change one ...
0
votes
1answer
87 views

Multiplying 2d arrays(matrices) in java

My goal is to print out the Matrix when the two arrays are multiplied together. What am I doing wrong with this code? How do I get it so that it prints out the matrix? (Sorry I do not know what ...
-2
votes
1answer
99 views

What does 'An Access Violation (Segmentation Fault) raised in your program' mean?

My C program compiles and works fine until I call this function from main() void rearrangeMainDiagonal(int mat[MAX_ORDER][MAX_ORDER], int order) { int i, j, k=0, l=0, n=0; int temp[20], ...
0
votes
0answers
59 views

Substitute matrix storage translating jagged into multidimensional array

I am trying to implement code & algorithms found here: MSDN Magazine Matrix Decomposition Because of some specific requirements I have to use C# Multidimensional array instead of Jagged array. I ...
1
vote
2answers
135 views

matrix index notation in C++

Can I index a multidimensional array with a single index? Ex: in memory, a multidimensional array is indexed like a single array (example in a matrix 2x2, matrix[1][1] is the fourth element of ...
3
votes
4answers
75 views

New to Multidimensional Arrays

I would like to build a program to manipulate multidimensional arrays, a new concept for me i would like to learn.... I assume it could have a few methods... public int get(int row, int column) // ...
1
vote
1answer
161 views

Using Java/Guava Optional<T> class to create and handle matrices of objects

I am considering using the Optional< T > class in Guava library to handle a matrix (2D grid) of objects, while avoiding the use of null references to denote empty cells. I am doing something like: ...
0
votes
1answer
136 views

Multiplying 2d arrays

Hey I am trying to multiply two dimensional arrays and I am confused. I have this code, but It Doesn't seem to work.. class MatrixMultiply{ public static void main(String[] args) { int ...
1
vote
3answers
83 views

c# multi variable array

Is there a way in c# to have an array of multiple variables? for instance, I have data for a stock: Date |Open |High |Low |Close 10-01-2012| 10.00| 11.01| 9.56| 10.56 10-02-2012| 10.56| 10.99| ...
4
votes
1answer
141 views

How to take outer product of more than two matrices in one shot, in matlab?

I want to compute y = a×a×a, where a is a n-by-1 vector, and × is the outer product operator. In this case y should be an n-by-n-by-n tensor. If y = a×a, it is easy. I simply do: y = a * a' But ...
0
votes
2answers
282 views

Android - Working with Multidimensional String Arrays

I'm having trouble working with multidimensional strings arrays and would appreciate any clarity. I'll post a sample code below that I wrote just to play around with to get an idea of how ...
1
vote
3answers
260 views

Exam pratice sample with matrices and recursion

This is a question from a past exam (Programming fundamentals), that I have no idea how to solve (after more than 2 hours trying): Program a method void fillingSumOfNeighbours(int[][]m) that, ...
1
vote
1answer
47 views

How to optimize 2 dimensional matrix reading speed?

I'm working on a 2D game. I have the game map saved on a js object {} called gameMap. My problem is that reading an item on the matrix takes too long. For collision detection I usually have to check ...
1
vote
2answers
205 views

Segmentation fault in a C program that create a matrix NxN of 1 and 0 from a file

I have the following problem: I have a file, let's says file1.dat that contains the following data: 1 2 3 1 2 1 1 3 3 2 I would like to write a program in C that reads from this file and create an ...
0
votes
5answers
120 views

Most efficient way of looping over 2 dimensional associative array?

I have a two dimensional associative array which contains a map of blocks that need to be drawn in a html5 canvas. It currently takes around 28ms to complete it, which is too much (I'm running the ...
1
vote
1answer
499 views

C++ matrix multiplication returning pointers for first and last 2 rows of array

I have an extremely infuriating problem with my C++ assignment. We are tasked to perform matrix multiplication within C++ using dynamic memory allocation. For the most part, the program works fine, ...
-1
votes
2answers
325 views

Java Matrices Arrays

This program adds two 3x3 matrices. It compiles and runs, but the output, instead of being: 1.0 2.0 3.0 0.0 2.0 4.0 1.0 4.0 7.0 4.0 5.0 6.0 + 1.0 4.5 2.2 = 5.0 9.5 8.2 ...
1
vote
2answers
120 views

Matrix Class in C++: An Explanation

I am currently browsing over some old college snippets of c++ code. Back then, one of the other class was assigned with doing a matrix class using double pointers and 2D arrays. Luckily (or unluckily ...
1
vote
1answer
184 views

Referring to a two dimensional array - rows and columns

I have a two dimensional array and I want to know how I can refer to the rows and columns in it. Do I use [row,column] or [column,row]? I also have some graphics. Do I calculate the (x,y) coordinate ...
2
votes
5answers
123 views

Matrix with variables in C

I'm going to write in pseudo code to make my question more clear. Please keep in mind this code will be done in C. Imagine I have an array of any amount of numbers. The first number tells me how big ...
1
vote
0answers
59 views

mutil dimension matrix addition

For my class we had to do a project in which the user can assign upto 4 matrices A B C D and then display it using malloc. Now I want to go to the next part and also give the user to add whichever ...
2
votes
2answers
319 views

Creating a two dimensional array from a file input in C

TL;DR: Struggling with 2 dimensional arrays. I'm trying to create two two dimensional array from a list of integers from a text file. This is programmed in C. tester.txt contains: 2 1 2 3 4 5 6 7 8 ...
1
vote
0answers
83 views

Would cartesian product be the best approach for this

Related Questions: Matrix Combination Logic Efficient way to determine the outcome of test matrix I have 25 individual validations that I need to test all possible combinations, I have seen a ...
0
votes
1answer
44 views

Two Way EntityCollection Binding to a Two Dimension Data Matrix

I have a Day Strucuture Table, which has following Columns I want to display: DoW HoD Value 1 1 1 1 2 2 1 3 2 1 4 2 1 5 2 1 6 2 1 7 2 1 8 2 1 9 2 1 10 2 1 11 ...
0
votes
1answer
151 views

How to store matrix into 2D array?

okay i have a file that looks like this: 2 3 6 6 22 -1 3 0 the integers in the first row are the dimensions of the matrix (not to be included in the matrix) the rows below the dimensions are the ...
1
vote
1answer
131 views

Two dimensional array in SD Card is too slow

I'm working on a project which processes images in Java. Now I have a problem with too much MB. I have the matrix, about 70,000 rows and 500 columns, and it is stored on the SD Card. Accessing the ...
0
votes
0answers
44 views

Matrix (Linear Algebra) - Product vs Summation [closed]

Why can't actually we do product one by one unlike summation. For 4x4 matrixes etc. (Doesnt coun't for 2x2 matrixes etc.) Its about Linear Algebra. I'd really appreciate who could explain it to me, ...
-2
votes
4answers
133 views

how do i convert a multiline array into one which has counts for keys and zeros where there are no counts?

If I have a multiline array and it contains for example the following integers with different numbers of integers per line: 1 1 1 2 1 1 2 1 4 1 2 1 1 3 1 6 How do I convert it to an array of counts ...
1
vote
1answer
295 views

joining two numpy matrices

If you have two numpy matrices, how can you join them together into one? They should be joined horizontally, so that [[0] [1] [[0][1] [1] + [0] = [1][0] ...
0
votes
1answer
264 views

error in plotting a 3D matrix as a 3D bar graph

Hi I have the 3D matrix daily_renewables_excess which I am trying to plot a 3D bar graph for the x y and z dimensions in axis. The size(daily_renewables_excess) is 11,7,10. So I am trying to get a 3D ...
0
votes
3answers
820 views

How to cast simple pointer to a multidimensional-array of fixed size?

I have a function that takes a pointer to a floating point array. Based on other conditions, I know that pointer is actually pointing to a 2x2 OR 3x3 matrix. (in fact the memory was initially ...
0
votes
1answer
192 views

MATLAB - why does this index exceed the matrix dimensions?

Hi I have this code which keeps giving me a "index exceeds matrix dimensions" error. I am trying to start the loop for h=1, d= 1 for 24 "h" and 3 "d" with a value for the "battery_capacity" matrix ...
0
votes
2answers
191 views

move rows in matlab vector to a new dimension

I have the vector output = PV_out(:); I am trying to break this down into some sort of form like - output(K) where output(1) is the first 8760 rows, output (2) is the next 8760 rows etc etc The ...
0
votes
2answers
298 views

All Permutations of Elements in a 2D Vector (Cartesian Product)

This is a small part that I've been stuck on, and it's part of a much larger assignment. I have a 2D vector such as: v1: 0 1 2 3 4 v2: 0 1 2 v3: 0 1 2 3 4 v4: 0 1 2 3 v5: 0 1 2 3 4 ...
0
votes
2answers
2k views

Get the Rows and Columns from a 2D array matrix in Java

Suppose that I have a 2D array (matrix) in Java like this... int[][] MyMat = {{0,1,2,3,4}, {9,8,7,6,5}}; If I want to extract the columns, I can do it easily like this... int[] My0= MyMat[0]; ...
1
vote
2answers
467 views

How do I compute the linear index of a 3D coordinate and vice versa?

If I have a point (x, y z), how do I find the linear index, i for that point? My numbering scheme would be (0,0,0) is 0, (1, 0, 0) is 1, . . ., (0, 1, 0) is the max-x-dimension, .... Also, if I have a ...
3
votes
2answers
182 views

4-dimensional array allocation: access violation

I wrote this simple piece of code to dynamically allocate a 4-dimensional array: #include <stdlib.h> #include <stdio.h> int**** alloc() { int i,j,k; int ****matrix; int ...
1
vote
3answers
74 views

PHP Matrix Peek Right, Down, Left, Up In The Arrays

I have a 3x3 matrix in PHP: 2 4 6 5 4 7 8 5 7 Assuming I am on the [0,0] element so 2. What is the best way to store where I am in the multi-dimensional array in a variable $current? I am thinking ...
2
votes
1answer
254 views

I have troubles reconstructing decomposed tensor in matlab

We have a tensor in matlab of size 308 x 22 x 29 x 12 x 492020 It is pretty big. We did decomposition on it and it worked fine. Now we are trying to reconstruct it back to get some predictions. When ...
2
votes
2answers
207 views

a matrix file load into Perl

I have a square matrix file, and I want to load it into Perl. I want to operate like 2 dimensional array which in C is like matrix[14][50], and then it goes directly to row 14 column 50. Is there a ...
0
votes
1answer
191 views

Selecting a NxM sub matrix from boost::MultiArray by varaible

I have multiple NxM matrices and want to select one of them by a variable. My best guess was to use boost::MultiArray to create a NxMxP matrix an then select via third dimension. I implemented it ...
1
vote
2answers
158 views

indexing into an octave array using another array

Hi I have an three dimensional octave array A of size [x y z] Now I have another array B of dimensions n * 3 say B(0) gives [3 3 1] I need to access that location in A ie A(3, 3, 1) = say 15 ...
0
votes
2answers
774 views

Writing a function to allocate an upper triangular matrix

I am trying to write a function to allocate an upper triangular matrix. it should return a pointer to the first element of the allocated array. I also need to use dynamic allocation to ensure that the ...
0
votes
1answer
435 views

Using multidimensional std::initializer_list

I have a question about the use of multidimensional std::intializer_list in C++. I have a Matrix class, and I want to be able to initialize it like this: Matrix<int, 3, 3> m({{1, 2, 3}, {4, 5, ...

1 2
15 30 50 per page