CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Need a Fortran Function (http://www.cfd-online.com/Forums/main/15491-need-fortran-function.html)

CFD girl July 30, 2008 12:46

Need a Fortran Function
 
Hi, I need a function in Fortran to multiply a matrix by a scalar.Is there any? Thanks

mettler July 30, 2008 14:39

Re: Need a Fortran Function
 
that is a simple loop. You should be able to do that yourself..:)

jinwon park July 30, 2008 15:39

Re: Need a Fortran Function
 
Function multMat(a,Mat,m,n) implicit double precision(a-h,o-z) DIMENSION Mat(m,n),multMat(m,n) !---------------------------------- DO i=1,m

DO j=1,n

multMat(i,j)=a*Mat(i,j)

ENDDO ENDDO

! or just multMat=a*Mat ! same as the above routine

end function


Anishtain4 August 10, 2008 03:41

Re: Need a Fortran Function
 
If you don't write an index fortran consider it all. for example: mat = mat*s mat(i,:)=mat(i,:)*s mat(:,j)=mat(:,j)*s


All times are GMT -4. The time now is 01:09.