Search Results

Search found 593 results on 24 pages for 'n dimensional'.

Page 1/24 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Design Book–Dimensional or No Dimensional, that is..the question

    - by drsql
    So, it is right there in the title of the book “Relational Database Design” etc (the title is kinda long :)  But as I consider what to cover and, conversely, what not to cover, dimensional design inevitably pops up. So I am considering including it in the book. One thing I try to do is to cover topics to a level where you can start using it immediately, and I am not sure that I could get a deep enough coverage of the subject to do that. I don’t really feel like it has to be the definitive source...(read more)

    Read the article

  • from one-dimensional to two-dimensional array

    - by Thijs
    Hi again, I have this PHP one dimensional array: Array ( [Female--N] => 11 [Male--N] => 11 [Humans--N] => 11 [Adult--N] => 8 [Adolescent--N] => 8 [Reaction Time-physiology--N] => 6 [Acoustic Stimulation-methods--N] => 6 [Schizophrenia-genetics--Y] => 5 [Motion Perception--N] => 3 ) And i want a new array from this that looks like (i think this tow-dimensional..?): Array ( [Female][N] => 11 [Male][N] => 11 [Humans][N] => 11 [Adult][N] => 8 [Adolescent][N] => 8 [Reaction Time-physiology][N] => 6 [Acoustic Stimulation-methods][N] => 6 [Schizophrenia-genetics][Y] => 5 [Motion Perception][N] => 3 ) Can i use split method on key elements? Little bit harder... i also need to split on the single '_' underscore, i did this to prevent the columns getting mixed up... But the example below doesn't do the job right... $new_array = array(); foreach($MeshtagsArray as $key => $value) { $parts = explode('__', $key, 2); $parts2 = explode('_', $key, 2); $new_array[] = array( 'discriptor' => $parts[0], 'qualifier' => $parts2[1], 'major' => $parts[1], '#occurence' => $value ); So the output should be something like: [0] => Array ( [discriptor] => Female [qualifier] => [major] => N [#occurence] => 11 ........ [5] => Array ( [discriptor] => Reaction Time [qualifier] => physiology [major] => N [#occurence] => 6 Best regards, Thijs

    Read the article

  • Translating 3-dimensional array reference onto 1-dimensional array

    - by user146780
    If there is an array of ar[5000] then how could I find where element [5][5][4] would be if this was a 3 dimensional array? Thanks I'm mapping pixels: imagine a bimap of [768 * 1024 * 4] where would pixel [5][5][4] be? I want to make this: static GLubyte checkImage[checkImageHeight][checkImageWidth][4]; static GLuint texName; bool itt; void makeCheckImage(void) { Bitmap *b = new Bitmap(L"c:/boo.png"); int i, j, c; Color cul; for (i = 0; i < checkImageHeight; i++) { for (j = 0; j < checkImageWidth; j++) { b->GetPixel(j,i,&cul); checkImage[i][j][0] = (GLubyte) cul.GetR(); checkImage[i][j][1] = (GLubyte) cul.GetG(); checkImage[i][j][2] = (GLubyte) cul.GetB(); checkImage[i][j][3] = (GLubyte) cul.GetA(); } } delete(b); } work without making a multidimensional array. width = 512, height = 1024....

    Read the article

  • Generate n-dimensional random numbers in Python

    - by Magsol
    I'm trying to generate random numbers from a gaussian distribution. Python has the very useful random.gauss() method, but this is only a one-dimensional random variable. How could I programmatically generate random numbers from this distribution in n-dimensions? For example, in two dimensions, the return value of this method is essentially distance from the mean, so I would still need (x,y) coordinates to determine an actual data point. I suppose I could generate two more random numbers, but I'm not sure how to set up the constraints. I appreciate any insights. Thanks!

    Read the article

  • Searching for a key in a multi dimensional array and adding it to another array [migrated]

    - by Moha
    Let's say I have two multi dimensional arrays: array1 ( stuff1 = array ( data = 'abc' ) stuff2 = array ( something = '123' data = 'def' ) stuff3 = array ( stuff4 = array ( data = 'ghi' ) ) ) array2 ( stuff1 = array ( ) stuff3 = array ( anything = '456' ) ) What I want is to search the key 'data' in array1 and then insert the key and value to array2 regardless of the depth. So wherever key 'data' exists in array1 it gets added to array2 with the exact depth (and key names) as in array1 AND without modifying any other keys. How can I do this recursively?

    Read the article

  • Two dimensional virtual desktop space in Ubuntu

    - by Herms
    Is there any way to create a 2-dimensional virtual desktop space in Ubuntu? The only control I'm seeing is the number of virtual desktops, but they seem to only go in a line. I'm used to having a 2-dimensional space (so I can go up/down/left/right instead of just left/right), and I'd really like to have that in ubuntu as well.

    Read the article

  • One dimensional cutting algorithm with minimum waste

    - by jm666
    Can anybody point me to some resources about "cutting algorithm"? The problem: have rods with length of L meters, e.g. 6 m need cut smaller pieces of different lengths, e.g. need: 4 x 1.2m 8 x 0,9m etc... (many other lengths and counts) How to determine the optimal cutting, what will produce the minimum wasted material? I'm capable write an perl program, but haven't any idea about the algorithm. (if here is already some CPAN module what can help, would be nice). Alternatively, if someone can point me to some "spreadsheet" solution, or to anything what helps. Ps: in addition, need care about the "cutting line width" too, whats means than from the 6m long rod is impossible to cut 6 x 1m, because the cutting itself takes "3mm" width, so it is possible cut only 5 x 1m and the last piece will be only 98.5 cm (1m minus 5 x 3mm cut-width) ;(.

    Read the article

  • PowerPivot and Parent/Child hierarchies

    - by AlbertoFerrari
    Does PowerPivot handle Parent/Child hierarchies? The common answer is “no”, since it does not handle them natively. During last PowerPivot course in London, I have been asked the same question once more and had an interesting discussion about this severe limitation of the PowerPivot data modeling and visualization capabilities. On my way back in Italy, I started thinking at a possible solution and, after some work, I managed to make PowerPivot handle Parent/Child hierarchies in a very nice way, which...(read more)

    Read the article

  • How are two-dimensional arrays formatted in memory?

    - by Chris Cooper
    In C, I know I can dynamically allocate a two-dimensional array on the heap using the following code: int** someNumbers = malloc(arrayRows*sizeof(int*)); for (i = 0; i < arrayRows; i++) { someNumbers[i] = malloc(arrayColumns*sizeof(int)); } Clearly, this actually creates a one-dimensional array of pointers to a bunch of separate one-dimensional arrays of integers, and "The System" can figure you what I mean when I ask for: someNumbers[4][2]; But when I statically declare a 2D array, as in the following line...: int someNumbers[ARRAY_ROWS][ARRAY_COLUMNS]; ...does a similar structure get created on the stack, or is it of another form completely? (i.e. is it a 1D array of pointers? If not, what is it, and how do references to it get figured out?) Also, when I said, "The System," what is actually responsible for figuring that out? The kernel? Or does the C compiler sort it out while compiling?

    Read the article

  • How can i create an n-dimensional array in c

    - by shortCircuit
    I was thinking of making a function that would accept the size of array as a parameter and create a n dimensional array. My room-mate took the liberty of making it complex. He said lets write a function that takes n parameters and returns an n-dimensional array using those parameters as the dimensions. Now i realize an one-day and d array is easy to implement with pointers. For 2d array the snippet would be something like (standard way) : int** x; int* temp; x = (int**)malloc(m * sizeof(int*)); temp = (int*)malloc(m*n * sizeof(int)); for (int i = 0; i < m; i++) { x[i] = temp + (i * n); } where the array is of size m*n; But the problem lies how do we find the nested loop parameters for a n-dimensional array? Is there any way to optimize the code?

    Read the article

  • Finding and marking the largest of three values in a two dimensional array

    - by DavidYell
    I am working on a display screen for our office, and I can't seem to think of a good way to find the largest numerical value in a set of data in a two dimensional array. I've looked at using max() and also asort() but they don't seem to cope with a two dimensional array. I'm returning my data through our mysql class, so the rows are returned in a two dimensional array. Array( [0] => Array( [am] => 12, [sales] => 981), [1] => Array( [am] => 43, [sales] => 1012), [2] => Array( [am] => 17, [sales] => 876) ) I need to output a class when foreaching the data in my table for the AM with the highest sales value. Short of comparing them all in if statements. I have tried to get max() on the array, but it returns an array, as it's look within the dimension. When pointing it at a specific dimension it returns the key not the value. I figured that I could asort() the array and pop the top value off, store it in a variable and then compare against that in my foreach() loop, but that seems to have trouble sorting across two dimensions. Lastly, I figured that I could foreach() the values, comparing them against the previous one each time, untill I found the largest. This approach however means storing every value, luckily only three, but then comparing against them all again. Surely there must be a simpler way to achieve this, short of converting it into a single dimension array, then doing an asort() on that?

    Read the article

  • Question regarding two dimensional array

    - by Sherwood Hu
    I have some problems using two dimensional array in the code and need some help. static const int PATTERNS[20][4]; static void init_PATTERN() { // problem #1 int (&patterns)[20][4] = const_cast<int[20][4]>(PATTERNS); ... } extern void UsePattern(int a, const int** patterns, int patterns_size); // problem #2 UsePattern(10, PATTERNS, sizeof(PATTERNS)/sizeof(PATTERNS[0])); in the first statement, I need to cast the const off the two dimensional array PATTERNS. The reason for this is that the init function is called only once, and in the remaining code, PATTERNS is strictly read-only. In the second statement, I need to pass PATTERNS array to the int** argument. Direct passing resulted a compile error. Thanks!

    Read the article

  • How to foreach through a 2 dimensional array?

    - by Scott Langham
    If I've got a 2 dimensional array. string[,] table = { { "aa", "aaa" }, { "bb", "bbb" } }; And I'd like to foreach through it like this. foreach (string[] row in table) { Console.WriteLine(row[0] + " " + row[1]); } But, I get the error "Can't convert type string to string[] Is there a way I can achieve what I want, i.e. iterate through the first dimension of the array with the iterator variable returning me the 1 dimensional array for that row? Thanks.

    Read the article

  • Variable number of two-dimensional arrays into one big array

    - by qlb
    I have a variable number of two-dimensional arrays. The first dimension is variable, the second dimension is constant. i.e.: Object[][] array0 = { {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"}, {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"}, ... }; Object[][] array1 = { {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"}, {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"}, ... }; ... Object[][] arrayi = ... I'm generating these arrays with a for-loop: for (int i = 0; i < filter.length; i++) { MyClass c = new MyClass(filter[i]); //data = c.getData(); } Where "filter" is another array which is filled with information that tells "MyClass" how to fill the arrays. "getData()" gives back one of the i number of arrays. Now I just need to have everything in one big two dimensional array. i.e.: Object[][] arrayComplete = { {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"}, {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"}, ... {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"}, {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"}, ... ... }; In the end, I need a 2D array to feed my Swing TableModel. Any idea on how to accomplish this? It's blowing my mind right now.

    Read the article

  • Selecting a multi-dimensional array in LINQ

    - by mckhendry
    I have a task where I need to translate a DataTable to a two-dimensional array. That's easy enough to do by just looping over the rows and columns (see example below). private static string[,] ToArray(DataTable table) { var array = new string[table.Rows.Count,table.Columns.Count]; for (int i = 0; i < table.Rows.Count; ++i) for (int j = 0; j < table.Columns.Count; ++j) array[i, j] = table.Rows[i][j].ToString(); return array; } What I'd really like to do is use a select statement in LINQ to generate that 2D array. Unfortunately it looks like there is no way in LINQ to select a multidimensional array. Yes, I'm aware that I can use LINQ to select a jagged array, but that's not what I want. Is my assumption correct, or is there a way to use LINQ to select a multi-dimensional array?

    Read the article

  • In .NET, What Is Fastest Way to Initialize Multi-Dimensional Array to Non-Default Value

    - by AMissico
    How do I initialize a multi-dimensional array of a primitive type as fast as possible? I am stuck with using multi-dimensional arrays. My problem is performance. The following routine initializes a 100x100 array in approx. 500 ticks. Removing the int.MaxValue initialization results in approx. 180 ticks just for the looping. Approximately 100 ticks to create the array without looping and without initializing to int.MaxValue. Routines similiar to this are called a few tens-of-thousands to several million times. I am open to suggestions on how to optimize this non-default initialization of an array. One idea I had is to use a smaller primitive type when available. For instance, using byte instead of int, saves 100 ticks. I would be happy with this, but I am hoping that I don't have to change the primitive data type. public int[,] CreateArray(Size size) { int[,] array = new int[size.Width, size.Height]; for (int x = 0; x < size.Width; x++) { for (int y = 0; y < size.Height; y++) { array[x, y] = int.MaxValue; } } return array; }

    Read the article

  • Computing, storing, and retrieving values to and from an N-Dimensional matrix

    - by Adam S
    This question is probably quite different from what you are used to reading here - I hope it can provide a fun challenge. Essentially I have an algorithm that uses 5(or more) variables to compute a single value, called outcome. Now I have to implement this algorithm on an embedded device which has no memory limitations, but has very harsh processing constraints. Because of this, I would like to run a calculation engine which computes outcome for, say, 20 different values of each variable and stores this information in a file. You may think of this as a 5(or more)-dimensional matrix or 5(or more)-dimensional array, each dimension being 20 entries long. In any modern language, filling this array is as simple as having 5(or more) nested for loops. The tricky part is that I need to dump these values into a file that can then be placed onto the embedded device so that the device can use it as a lookup table. The questions now, are: What format(s) might be acceptable for storing the data? What programs (MATLAB, C#, etc) might be best suited to compute the data? C# must be used to import the data on the device - is this possible given your answer to #1?

    Read the article

  • CoffeeScript 2 Dimensional Array Usage

    - by Chris
    I feel like I'm missing something with CoffeeScript and 2 dimensional arrays. I'm simply attempting to make a grid of spaces (think checkers). After some searching and a discovery with the arrays.map function, I came up with this: @spaces = [0...20].map (x)-> [0...20].map (y) -> new Elements.Space() And this seems to work great, I have a nice 2 dimensional array with my Space object created in each. But now I want to send the created space constructor the x,y location. Because I'm two layers deep, I lost the x variable when I entered the map function for y. Ideally I would want to do something like: @spaces = [0...20].map (x)-> [0...20].map (y) -> new Elements.Space(x, y) or something that feels more natural to me like: for row in rows for column in row @spaces[row][column] = new Elements.Space(row, column) I'm really open to any better way of doing this. I know how I would do it in standard JavaScript, but really would like to learn how to do it in CoffeeScript.

    Read the article

  • 2 dimensional array

    - by ankit
    $city=array('delhi','noida','mumbai','noida'); $name=array('ankit','atul','ramu','manu'); i want to create a 2 dimensional array using the two arrays above,with the name of the cities as keys and the corresponding names as the values.the names must be sorted. plz help me

    Read the article

  • Parse 2 dimensional JSON array in Javascript

    - by MrG
    I have a two dimensional JSON array where each element contains several attributes. The example below is intentionally simplified: var map_data = { "1": {"1":{"name":"aa"},"2":{"name":"bb"}}, "2": {"1":{"name":"cc"},"2":{"name":"dd"}} }; I try to parse the data but .length doesn't work: for(x=1; x<=map_data.length; x++) { for(y=1; y<=map_data[x].length; y++) { // CODE } } Many, many thanks!

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >