This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
>>>>> "Per" == Per Bothner <bothner@cygnus.com> writes: >> My suggestion was, thus: 1) to give user the possibility to know >> that a given multi-dimensional array can be treated as >> one-dimensional; 2) to have a standard procedure to get a pointer >> to this chunk. Per> I cannot see how this can be mathematically meaningful, in Per> general, nor do I see any use for it (except perhaps some Per> optionization). Probably, I was not clear enough. If I have non-shared multi-dim array, it is, in agreement with your consideration, a one-dimensional chunk of data, with additional information about dimensions. This corresponds to the treatment of multi-dimensional arrays in FORTRAN or C (if you define them as A[n][m]), with the only difference that A[n][m] in C corresponds to A(m,n) in FORTRAN. Thus, having such chunk, you can put it in the argument of C or FORTRAN routine. If you have shared array, you must, in general, make a new one-dimensional chunk, and copy there values from the shared array, before using it in arguments of FORTRAN/C procedures (although many matrix libraries provide additional arguments in their procedures to allow working with partially filled arrays). Thus, I would like to have possibility to distinguish between these two situations, and, _if_it_is_possible_, to use the underlying one-dimensional chunk of multi-dim. array directly, without copying its data to new location (and back). Few words, why I think it is important for numerical applications. For me, using guile for such applications means, first of all, to provide effective interplay with routines, written in C and FORTRAN. I, personally, use BLAS and LAPACK for matrix calculations. Let us suppose, I want to use the optimized BLAS routine for multiplication of matrix A[n][n] and vector V[n] for 10000 different vectors V, but the same matrix A. Do you think, it is worth to allocate temporary storage for copy of A, and to copy there elements of A (like gh_scm2doubles does) each time I call this subroutine (just to generate correct argument list) in the case of n=10000 ? I want to emphasize that, for my work, this is a _typical_ example. -- Best regards, V.Kamyshenko.