Logo

Programming-Idioms

History of Idiom 202 > diff from v2 to v3

Edit summary for version 3 by spectrum:
[Fortran] simplified my old code

Version 2

2019-09-28, 21:33:13

Version 3

2019-09-28, 21:44:19

Idiom #202 Sum of squares

Calculate the sum of squares s of data, an array of floating point values.

Idiom #202 Sum of squares

Calculate the sum of squares s of data, an array of floating point values.

Code
real, allocatable :: data(:)
...
s = sum( data**2 )
Code
s = sum( data**2 )
Comments bubble
data may be a multidimensional array (e.g. data(:,:)).
Comments bubble
data may be a multidimensional array (e.g. data(:,:)).