tag:blogger.com,1999:blog-8724479949460106754.post2329664471011937089..comments2023-03-30T02:53:48.104-07:00Comments on Charlie's Second Blog: How to compute "y = a * x + y"Guillaumehttp://www.blogger.com/profile/04248189602756889056noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8724479949460106754.post-51007966673887762812009-02-03T07:39:00.000-08:002009-02-03T07:39:00.000-08:00Ok if you count the sum of letters in this simple ...Ok if you count the sum of letters in this simple example the fortran version is not the best, but that is only because the header part of the function is longer, the core itself is very simple : y = a * x + y<BR/><BR/>Now if we had a serie of similar operations, fortran would then look better.<BR/><BR/>Anyway, i want to express things as a vector operation, that is the point, and c won't let me do this in a "beautiful" way.Guillaume Chéreauhttps://www.blogger.com/profile/05367152763264281576noreply@blogger.comtag:blogger.com,1999:blog-8724479949460106754.post-81805690283918075002009-02-03T06:25:00.000-08:002009-02-03T06:25:00.000-08:00Excuse me, but if you found this:void func(float x...Excuse me, but if you found this:<BR/><BR/>void func(float x[N], float y[N], float a) {<BR/> for(size_t i = 0; i < N; ++i) {<BR/> y[i] += a * x[i];<BR/> }<BR/>}<BR/><BR/>or this :<BR/><BR/>cblas_daxpy(N, a, x, 1, y, 1);<BR/><BR/>"over complicated", compared to this:<BR/><BR/>subroutine func(x, y, a)<BR/> implicit none<BR/> REAL, dimension(:), intent(in) :: x<BR/> REAL, dimension(:), intent(inout) :: y<BR/> REAL, intent(in) :: a<BR/><BR/> y = a * x + y<BR/><BR/>end subroutine func<BR/><BR/>...<BR/><BR/>We really don't think the same !!! Just make the sum of letters of all functions !Anonymousnoreply@blogger.com