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

  • Context: Fortran 
  • Thread starter Thread starter dwnlder
  • Start date Start date
  • Tags Tags
    2d Array Vector
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
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.
 
Physics news on Phys.org