How to Add a Vector to a 2D Array in Fortran 90?

1 reply · 2K views · last reply
dwnlder
Messages
1
Reaction score
0
hi. i have a quick question regarding fortran 90. i often need to add a vector to a 2d dimensional array, and i find it a bit to 'bulky' to always use do loops.

let's say i have this:
Code:
do i=1, 20
   a(:, i)=a(:, i)+b(:)
end do

is there a simple(r) way to tell fortran that i want to add the values to the 'first' value of the array? so i could use something as simple as
Code:
a(:, :)=a(:, :)+b(:)

thx in advance for the answers and suggestions.
 
You could either write a quick FUNCTION or perhaps define a custom operator.