digitalmars.D - Einstein summation
- =?iso-8859-1?q?Knud_S=F8rensen?= (31/31) May 02 2004 Hi
- resistor AT nospam DOT mac DOT com (9/40) May 02 2004 I'm not sure how desirable it would be to have such specialized syntax i...
- School (5/75) May 03 2004 I also agree that D is not something like Maple or such. It is not
- =?iso-8859-1?q?Knud_S=F8rensen?= (22/36) May 04 2004 The Einstein summation is not a specialization but
Hi I am new to D. But I think is is very promising. While it have better support for arrays than c/c++; There is sill space for improvements. I will suggests build in support for Einstein summation! That is automatic summation over the same indexes. index[3] i,j,k; // 3 dimensional indexes. double[3] v,v1,v2; double[3][3] m; // dot product p=v[k]*v[k]; // Vector & Matrix multiplication. v2[i]=m[i][k]*v1[k]; // transposing a matrix is also easy // just switch the indexes. v2[i]=m[k][i]*v1[k]; // trace of matrix tr = m[i][i]; // quadratic forms q=v[i]*m[i][k]*v[k]; // cross product. v[i]=P(i,j,k)*v1[j]*v2[k]; // P(i,j,k) is the permutation tensor etc. see http://mathworld.wolfram.com/EinsteinSummation.html Because this notation don't dictate a specials order of execution it should be possible for the compiler to parallelize this code for MMX,FPGA's and GPU's.
May 02 2004
I'm not sure how desirable it would be to have such specialized syntax in the core language, but you'll be glad to know that with D's operator overloading it should be fairly simple to write classes to work exactly like that. Owen In article <pan.2004.05.02.21.20.02.48217 NetRunner.all-technology.com>, =?iso-8859-1?q? Knud_S=F8rensen?= says...Hi I am new to D. But I think is is very promising. While it have better support for arrays than c/c++; There is sill space for improvements. I will suggests build in support for Einstein summation! That is automatic summation over the same indexes. index[3] i,j,k; // 3 dimensional indexes. double[3] v,v1,v2; double[3][3] m; // dot product p=v[k]*v[k]; // Vector & Matrix multiplication. v2[i]=m[i][k]*v1[k]; // transposing a matrix is also easy // just switch the indexes. v2[i]=m[k][i]*v1[k]; // trace of matrix tr = m[i][i]; // quadratic forms q=v[i]*m[i][k]*v[k]; // cross product. v[i]=P(i,j,k)*v1[j]*v2[k]; // P(i,j,k) is the permutation tensor etc. see http://mathworld.wolfram.com/EinsteinSummation.html Because this notation don't dictate a specials order of execution it should be possible for the compiler to parallelize this code for MMX,FPGA's and GPU's.
May 02 2004
resistor AT nospam DOT mac DOT com ´£¨ì:I'm not sure how desirable it would be to have such specialized syntax in the core language, but you'll be glad to know that with D's operator overloading it should be fairly simple to write classes to work exactly like that. Owen In article <pan.2004.05.02.21.20.02.48217 NetRunner.all-technology.com>, =?iso-8859-1?q? Knud_S=F8rensen?= says...I also agree that D is not something like Maple or such. It is not designed to meet maths problems but meets any kind of problems. If you are interested in making a library for that, we are happy to download it and use it :-D.Hi I am new to D. But I think is is very promising. While it have better support for arrays than c/c++; There is sill space for improvements. I will suggests build in support for Einstein summation! That is automatic summation over the same indexes. index[3] i,j,k; // 3 dimensional indexes. double[3] v,v1,v2; double[3][3] m; // dot product p=v[k]*v[k]; // Vector & Matrix multiplication. v2[i]=m[i][k]*v1[k]; // transposing a matrix is also easy // just switch the indexes. v2[i]=m[k][i]*v1[k]; // trace of matrix tr = m[i][i]; // quadratic forms q=v[i]*m[i][k]*v[k]; // cross product. v[i]=P(i,j,k)*v1[j]*v2[k]; // P(i,j,k) is the permutation tensor etc. see http://mathworld.wolfram.com/EinsteinSummation.html Because this notation don't dictate a specials order of execution it should be possible for the compiler to parallelize this code for MMX,FPGA's and GPU's.
May 03 2004
On Mon, 03 May 2004 21:44:11 +0800, School wrote:resistor AT nospam DOT mac DOT com:The Einstein summation is not a specialization but a generalization of vector, matrix and tensor operations. Which is more used in programing than complex numbers, and thus d got all ready. How it is possible to tell the compiler how it should optimize on overloaded operators ????I'm not sure how desirable it would be to have such specialized syntax in the core language, but you'll be glad to know that with D's operator overloading it should be fairly simple to write classes to work exactly like that. OwenNo, but D is a programing language like FORTRAN. And FORTRAN is still a preferred language to use for scientific calculations. The reason is that FORTRAN have build in support for operations on arrays, and this make it possible for the FORTRAN compiler to make better use of the hardware. I think that making Einstein summation available in D will make it easier to specify complex calculations and make it better suited to replace FORTRAN in scientific computing. You might take a look at http://www.ii.uib.no/~krister/EinSum/ I don't think that D need the upper/lower notation he use. KnudI also agree that D is not something like Maple or such. It is not designed to meet maths problems but meets any kind of problems. If you are interested in making a library for that, we are happy to download it and use it :-D.
May 04 2004