arrays - Vector multiplication using MATMUL in Fortran -


i trying multiply part of column vector (n,1) part of row vector (1,n). both parts have same length. should matrix (n,n).

here simple code:

program test_pack_1 real :: m(1,10), x(10,1), y(10,10)  m = reshape( (/ 1, -1, 3, 2, 1, 2, -2, -2, 1, 0 /), (/ 1, 10 /)) x = reshape( (/ 1, 0, 1, 1, 0, 1, 1, 0, 1, 0 /), (/ 10, 1 /))  y(1:9,1:9) = matmul(x(1:9,1),m(1,1:9))   j = 1,10 print* ;write(*,*) y(:,j) enddo print *  end program 

i'm using:

ifort -g -debug -traceback -check -ftrapuv test_cshift.f90 

and i'm getting:

test_cshift.f90(7): error #6241: shapes of arguments inconsistent or nonconformable.   [matmul] y(1:9,1:9) = matmul(x(1:9,1),m(1,1:9)) -------------^ test_cshift.f90(7): error #6366: shapes of array expressions not conform.   [y] y(1:9,1:9) = matmul(x(1:9,1),m(1,1:9)) 

the problem x(1:9,1) isn't of shape [9 1] [9]. need use x(1:9, 1:1). same goes m.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -