Sponsored Content
Full Discussion: 2d arrays in unix
Top Forums Shell Programming and Scripting 2d arrays in unix Post 302344633 by jpriyank on Monday 17th of August 2009 07:32:38 AM
Old 08-17-2009
2d arrays in unix

hi everybody

can anyone help me with usage of 2 dimensional arrays in unix. please provide a suitable example for accessing individual elements as well as all elements.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing arrays to oracle from unix

Hi all Iam trying to send an array to oracle procedure from unix. Iam writing a program in K Shell to pass this array to oracle. Is it possible. Please advice thanks Krishna (7 Replies)
Discussion started by: krishnasai
7 Replies

2. UNIX for Dummies Questions & Answers

are Associative Arrays possible in UNIX?

Is it possible to say.. myArr=34 myArr=15 ? (11 Replies)
Discussion started by: yongho
11 Replies

3. Shell Programming and Scripting

Passing arrays to oracle from unix

Hi all... Im looking to pass the contents of a simple file to Oracle so that it can be stored in a database table. The best way i can think of to avoid overhead is to loop through the contents of the file and store the data in a bash array. then the array can be passed to SQL Plus where... (4 Replies)
Discussion started by: satnamx
4 Replies

4. Shell Programming and Scripting

Arrays in unix

I have a Main shell script file. In that the below lines(7) is spooled in Oracle & written to a file say temp.out INSTANCE_N ---------- undefined PROACT1 REPCAT1 PROACT2 REPCAT2 I want to ignore the first 3 lines & put the rest 4 lines PROACT1..REPCAT2 into the arrays. So that i can use... (2 Replies)
Discussion started by: dreams5617
2 Replies

5. Web Development

PHP arrays in arrays

PHP question... I have an SQL query that's pulled back user IDs as a set of columns. Rather than IDs, I want to use their names. So I have an array of columns $col with values 1,7,3,12 etc and I've got an array $person with values "Fred", "Bert", "Tom" etc So what I want to do is display the... (3 Replies)
Discussion started by: JerryHone
3 Replies

6. UNIX for Dummies Questions & Answers

Arrays in UNIX

Hi there, I have a small piece of code i=1 Number=10 while do echo "$i" Check=`cmd to give to me file name with path i=`expr ${i} + 1` done when i do in a loop echo "$Check"---------Unable to display, the values. ... (5 Replies)
Discussion started by: Naveen_5960
5 Replies

7. Shell Programming and Scripting

Parameters + arrays in unix shell

Say I have ./param HEY What would I do if I wanted to store each character into an array? Example. ARRAY1="H" ARRAY1="E" ARRAY1="Y" thank you! (5 Replies)
Discussion started by: puttster
5 Replies

8. Programming

question about int arrays and file pointer arrays

if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
Discussion started by: omega666
1 Replies

9. UNIX for Dummies Questions & Answers

Arrays in unix

hi all, is there any method to declare each line of a text file to array variable. my text file is: 123 222 333 so, a=123 a=222 a=333 can anyone help me out pls... thanks in advance, Arun Manas:b: (4 Replies)
Discussion started by: arunmanas
4 Replies

10. UNIX for Advanced & Expert Users

Arrays with UNIX Commands

Hi, Can anyone please guide me to pass the values for an array during runtime and use it. I am using Linux OS. what I am trying to do is, i am trying to pass the output of the ls <source folder> command to a array and copy the list of files in the array to a different (Destination) folder.... (7 Replies)
Discussion started by: shyamshankarj
7 Replies
MPI_Type_create_subarray(3OpenMPI)										MPI_Type_create_subarray(3OpenMPI)

NAME
MPI_Type_create_subarray - Creates a data type describing an n-dimensional subarray of an n-dimensional array. SYNTAX
C Syntax #include <mpi.h> int MPI_Type_create_subarray(int ndims, int array_of_sizes[], int array_of_subsizes[], int array_of_starts[], int order, MPI_Datatype oldtype, MPI_Datatype *newtype) Fortran Syntax INCLUDE 'mpif.h' MPI_TYPE_CREATE_SUBARRAY(NDIMS, ARRAY_OF_SIZES, ARRAY_OF_SUBSIZES, ARRAY_OF_STARTS, ORDER, OLDTYPE, NEWTYPE, IERROR) INTEGER NDIMS, ARRAY_OF_SIZES(*), ARRAY_OF_SUBSIZES(*), ARRAY_OF_STARTS(*), ORDER, OLDTYPE, NEWTYPE, IERROR C++ Syntax #include <mpi.h> MPI::Datatype MPI::Datatype::Create_subarray(int ndims, const int array_of_sizes[], const int array_of_subsizes[], const int array_of_starts[], int order) const INPUT PARAMETERS
ndims Number of array dimensions (positive integer). array_of_sizes Number of elements of type oldtype in each dimension of the full array (array of positive integers). array_of_subsizes Number of elements of type oldtype in each dimension of the subarray (array of positive integers). array_of_starts Starting coordinates of the subarray in each dimension (array of nonnegative integers). order Array storage order flag (state). oldtype Array element data type (handle). OUTPUT PARAMETERS
newtype New data type (handle). IERROR Fortran only: Error status (integer). DESCRIPTION
The subarray type constructor creates an MPI data type describing an n-dimensional subarray of an n-dimensional array. The subarray may be situated anywhere within the full array, and may be of any nonzero size up to the size of the larger array as long as it is confined within this array. This type constructor facilitates creating file types to access arrays distributed in blocks among processes to a single file that contains the global array. This type constructor can handle arrays with an arbitrary number of dimensions and works for both C- and Fortran-ordered matrices (that is, row-major or column-major). Note that a C program may use Fortran order and a Fortran program may use C order. The ndims parameter specifies the number of dimensions in the full data array and gives the number of elements in array_of_sizes, array_of_subsizes, and array_of_starts. The number of elements of type oldtype in each dimension of the n-dimensional array and the requested subarray are specified by array_of_sizes and array_of_subsizes, respectively. For any dimension i, it is erroneous to specify array_of_subsizes[i] < 1 or array_of_subsizes[i] > array of sizes[i]. The array_of_starts contains the starting coordinates of each dimension of the subarray. Arrays are assumed to be indexed starting from zero. For any dimension i, it is erroneous to specify array_of_starts[i] < 0 or array_of_starts[i] > (array_of_sizes[i] - array_of_subsizes[i]). The order argument specifies the storage order for the subarray as well as the full array. It must be set to one of the following: - MPI_ORDER_C: The ordering used by C arrays, (that is, row-major order) - MPI_ORDER_FORTRAN: The ordering used by Fortran arrays, (that is, column-major order) A ndims-dimensional subarray (newtype) with no extra padding can be defined by the function Subarray() as follows: newtype = Subarray(ndims, {size , size ,..., size }, 0 1 ndims-1 {subsize , subsize , ..., subsize }, 0 1 ndims-1 {start , start , ..., start }, oldtype) 0 1 bduns-1 Let the typemap of oldtype have the form: {(type , disp ), (type , disp ), ..., (type , disp )} 0 0 1 1 n-1 n-1 where typei is a predefined MPI data type, and let ex be the extent of oldtype. The Subarray() function is defined recursively in three equations on page 72 of the MPI-2 standard. For an example use of MPI_Type_create_subarray in the context of I/O, see Section 9.9.2 of the MPI-2 standard. NOTES
In a Fortran program with arrays indexed starting from 1, if the starting coordinate of a particular dimension of the subarray is n, then the entry in array of starts for that dimension is n-1. ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ func- tions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI:Exception object. Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. Open MPI 1.2 September 2006 MPI_Type_create_subarray(3OpenMPI)
All times are GMT -4. The time now is 09:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy