Vector times matrix multiplication.
program mvproduct
implicit none
real, dimension(3) :: V
real, dimension(2,3) :: A
real,dimension(2) :: W
integer :: i,j
print*,'please give V(1:3)'
read*,V
print*,'Please give A(1:2,1:3)';
read*,a
! The list of numbers from console is 1-dimensional, and is
! reshaped by the read function to the shape of A in column-wise order.
! compute the matrix*Vector product
do i=1,2 ! for each entry of w, compute w(i)
w(i)=0.0
do j=1,3
w(i)=w(i)+a(i,j)*V(j)
end do
end do
!print eVerything.
print*,'A='
do i=1,2
print*,(A(i,j),j=1,3) ! use implicit do loop to print all elements in row i
end do
print*,'V=',V
print*,'W=',w
!
end program mvproduct