forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Matrix/vector multiplication

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
myseyi123



Joined: 05 Mar 2015
Posts: 1

PostPosted: Fri Mar 06, 2015 12:11 pm    Post subject: Matrix/vector multiplication Reply with quote

I am new to fortran 95. I need help on how to multiply matrix and vectors. I have consulted books and online tutorial but to no avail.
Also, is silverfrost FTN95 code different from that of other publishers?
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Sat Mar 07, 2015 11:28 pm    Post subject: Reply with quote

There are intrinsic functions to help with this.
Dot_Product will multiply 2 vectors.
MATMUL will multiply 2 matrices of rank 2.

You need to understand how to declare the arrays and then use intrinsic functions. As you say you are new to Fortran 95, I am not sure to what detail you require further help. I suggest you google Fortran tutorials and see if you can follow the examples they have.

John
Back to top
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Sun Mar 08, 2015 4:34 pm    Post subject: Reply with quote

It is difficult to know what is being asked here. Help with the maths or help with code?

MATMUL can be used in 3 ways (using numeric data).

Code:

C = MATMUL(A,B)


(1) If A has shape (M,K) and B has shape (K,N), C will have shape (M,N)
(2) If A has shape (K) and B has shape (K,M), C will have shape (M)
(3) If A has shape (N, K) and B has shape (K), C will have shape (N)

(1) C(i,j) has the value SUM(A(i,:)*B(:,j)
(2) C(j) has the value SUM(A(:)*B(:,j))
(3) C(i) has the value SUM(A(i,:)*B(:))
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group