» Home » dimensional » Page 1
How to assign a particular row of two dimensional array passed as an argument of the function to one-dimensional vector in c++
by Ertaz in C & C++ & C#

This is what I do, but I get segmentation fault when I debug (Step Into -> v.assign() is the problem.

void vertex::sort_all_neighbours(int i, int **array, int size_array){
v.assign(&array[i][0], &array[i][size_array-1]);
//for (j = 0; j < size_array; j++) v[j] = array[i][j];
make_heap(v.begin(), v.end());

Convert Single-Dimensional array with child/parent relationships to Multi-Dimensional Tree in PHP
by Chunkee in PHP

I'm trying to write an algorithm to do the following:

In PHP/Postgres, I'm returning a 1-dimensional array from the database, and each row has a view_page_id as well as a view_page_parent_id. I've done a self-join on the table, and am returning the results sorted ASC by parent_id.

Here's an example:

[0] => Array

Creating a three dimensional jagged array to store two dimensional arrays of varying size in java
by Darren Torpey in Java

Say I have less than ten two dimensional arrays representing matrices in java. Each array is enumerated from 0 to 6. Each array is n*2^enumval larger where n is the number of elements from the 0th enumerated array, thus my multidimensional will almost be pyramid shaped, hence the need for a jagged three dimensional array. Is it possible to create a jagged three dimensional array?

matlab - creating a single dimensional array from two dimensional parts
by Miklebud in Programming Languages

hi i have the following situation

h = [0,1,1,1;

i'll check incoming values which can range between 0 and rowsize of h, i.e. in this case 2,. so my options are 0,1,2.

now i want to create a single dimensional array (let's name it j) as follows

whenever the incoming value is 0


How can i create a one-dimensional array to hold several two-dimensional arrays?
by Lucas Thompson in Programming Languages

I have a game I've been working on. It is a text based RPG adventure game. I hope to have the player navigate the world using simple text commands. I have set it up so that the world should be divided into "regions" or arrays. Each region is of the custom datatype Location and is composed of a two-dimensional array. I will use two variables to track the players location which are really the two

Finding dimensional index in a multi-dimensional array in R
by Idontcare in Programming Languages

Am looking at say 3-dimensional array M: M<-dim(3,3,3)

I want to find an efficient way to populate M with the following rule:
M[i,j,k] = i/10 + j^2 + sqrt(k),
ideally without having to write a loop with a for statemenet.

For clarification, there is a simple way to accomplishing this if M were 2-dimensional. If i wanted to hav

How to convert single dimensional arrays to multi dimensional ones? (C#)
by bdurbin in Programming Languages

I have to use a method which accepts double[,], but I only have a double[]. How can I convert it?

Solution so far:

var array = new double[1, x.Length];
foreach (var i in Enumerable.Range(0, x.Length))
array[0, i] = x;

assigning one row of a two dimensional array to a one dimensional matrix
by ruby-on-rails in Programming Languages

So I have a 2D array and I want to assign row 'pth' row of the 2D array to a new 1D array:
My code looks like this:

float temp[] = { *aMatrix[p] }; // aMatrix is a 10x10 array
// am trying to assign the pth row
// to temp.
*aMatrix[p] = *aMatrix[max];
*aMatrix[max] = *temp;
float t = b

C: two-dimensional array slower then single-dimensional?
by Ansari in Programming Languages

I thought, that if single-dimensional is implemented somehow like


so a[i][j] must be


Am I wrong?

Read here http://habrahabr.ru/blogs/algorithm/135948/

Думаю, не стоит говорить о том, что одномерный массив быст

Getting single dimensional array, not multi dimensional
by fstender in Web Design

When I run

[w*2 for w in [1, 2, 3]]

I get

[[2, 4, 6]]

but actually I want

[2, 4, 6]

Live example

Obviously following is in option, but I do not want to rely on that:

[w*2 for w in [1, 2, 3]][0]

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .