Masakatsu ITO <mito@masa.ims.ac.jp> writes:
> I had always wanted to simplify the fortran codes for linear algebraic
> expressions. Consider u = M*v + w, where u,v and w are vectors and
> M is matrix. Fortran requires multiple loops or subroutine calls with
> complicated argument list.
As of Fortran 90, this expression may be written:
u = matmul(M, v) + w
where, for example,
real, dimension(10) :: u, v, w
real, dimension(10,10) :: M
and matmul is an intrinsic function that will work for any two
compatible matrices (or a matrix and a vector) for integer, real,
complex or logical data types. Also, it will work for array sections,
like this:
u(3:7) = matmul(M(3:7,:), v(:)) + w(3:7)
which just calculates the third through seventh rows of the equation.
-Mike
============================================================================
Dr. Michael L. Hall <mailto:Hall@lanl.gov>
Los Alamos National Laboratory <http://www.lanl.gov/Hall>
P.O. Box 1663, MS-D409 Research: computational physics, radiation
Los Alamos, NM 87545 transport, heat pipes, numerical modeling,
ph: 505-665-4312 fluid dynamics, magnetohydrodynamics
============================================================================
--------------------- Object Oriented Numerics List --------------------------
* To subscribe/unsubscribe: use the handy web form at
http://oonumerics.org/oon/
* If this doesn't work, please send a note to owner-oon-list@oonumerics.org
This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 03:20:15 EST