1!
2!     CalculiX - A 3-dimensional finite element program
3!              Copyright (C) 1998-2021 Guido Dhondt
4!
5!     This program is free software; you can redistribute it and/or
6!     modify it under the terms of the GNU General Public License as
7!     published by the Free Software Foundation(version 2);
8!
9!
10!     This program is distributed in the hope that it will be useful,
11!     but WITHOUT ANY WARRANTY; without even the implied warranty of
12!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13!     GNU General Public License for more details.
14!
15!     You should have received a copy of the GNU General Public License
16!     along with this program; if not, write to the Free Software
17!     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18!
19      subroutine mult(matrix,trans,n)
20!
21      implicit none
22!
23      integer i,j,k,n
24      real*8 matrix(3,3),trans(3,3),a(3,3)
25!
26!     3x3 matrix multiplication. If n=1 then
27!        matrix=trans^T*matrix,
28!     if n=2 then
29!        matrix=matrix*trans.
30!
31      if(n.eq.1) then
32         do i=1,3
33            do j=1,3
34               a(i,j)=0.d0
35               do k=1,3
36                  a(i,j)=a(i,j)+trans(k,i)*matrix(k,j)
37               enddo
38            enddo
39         enddo
40      elseif(n.eq.2) then
41         do i=1,3
42            do j=1,3
43               a(i,j)=0.d0
44               do k=1,3
45                  a(i,j)=a(i,j)+matrix(i,k)*trans(k,j)
46               enddo
47            enddo
48         enddo
49      endif
50!
51      do i=1,3
52         do j=1,3
53            matrix(i,j)=a(i,j)
54         enddo
55      enddo
56!
57      return
58      end
59
60