4.4.1. Subroutine maxv (Multiplying a Vector by a Matrix)
*deck,maxv
subroutine maxv (a,v,w, nr,nc)
c *** primary function: multiply a matrix by a vector
c *** Notice - This file contains ANSYS Confidential information ***
c input arguments:
c a (dp,ar(nr,*),in) - matrix a
c v (dp,ar(*),in) - vector v
c nr (int,sc,in) - number of rows in matrix a
c nc (int,sc,in) - number of columns to multiply in matrix a
c output arguments:
c w (dp,ar(*),out) - product vector w
c
4.4.2. Subroutine maxv1 (Multiplying a Vector by a Matrix)
*deck,maxv1
subroutine maxv1 (a,v, nr,nc)
c *** primary function: multiply a vector by a matrix
c *** Notice - This file contains ANSYS Confidential information ***
c input arguments:
c a (dp,ar(nr,nc),in) - matrix a
c v (dp,ar(nc),inout) - vector v
c nr (int,sc,in) - number of rows in matrix a
c *** nr limited to 60 ***
c nc (int,sc,in) - number of columns to multiply in matrix a
c output arguments:
c v (dp,ar(nr),inout) - product, stored in vector v
c
4.4.3. Subroutine matxv (Multiplying a Vector by a Full Transposed Matrix)
*deck,matxv
subroutine matxv (a,v,w, nr,nc)
c *** primary function: multiply vector by full transposed matrix
c *** Notice - This file contains ANSYS Confidential information ***
c input arguments:
c a (dp,ar(nr,*),in) - matrix a (first dimension must = nr)
c v (dp,ar(nv),in) - vector v (nv must be greater or equal
c to nr)
c nr (int,sc,in) - first dimension and number of active
c rows of the untransposed matrix a
c (also the number of active rows
c of vector v)
c nc (int,sc,in) - number of columns of the untransposed
c matrix a
c (also the number of computed items
c in the product vector w)
c if negative, accumulate
c output arguments:
c w (dp,ar(na,*),out) - product vector w
c
c
c *** mpg A(nr,nc) : matrix transpose vector product
c w = A+ v : if nr > 0
c w = w + A+ v : if nr < 0
c
4.4.4. Subroutine matxv1 (Multiplying a Vector by a Full Transposed Matrix)
*deck,matxv1
subroutine matxv1 (a,v, nr,nc)
c *** primary function: multiply vector by full transposed matrix
c *** Notice - This file contains ANSYS Confidential information ***
c input arguments:
c a (dp,ar(nr,*),in) - matrix a
c v (dp,ar(nr),inout) - vector v
c nr (int,sc,in) - number of rows in matrix (un-transposed)
c nc (int,sc,in) - number of columns in matrix (un-transposed)
c *** nc limited to 60 ***
c output arguments:
c v (dp,ar(nc),inout) - product, stored in vector v
c
c *** A(nr,nc) : matrix transpose vector product
c v = A+ v : max 60 nc
4.4.5. Subroutine matxb (Transposing a matrix)
*deck,matxb
subroutine matxb (a,b,c, na,nb,nc, n1,n2,n3)
c *** primary function: (a)t * (b) = (c) t means transpose
c *** Notice - This file contains ANSYS Confidential information ***
c input arguments:
c a (dp,ar(na,*),in) - matrix a
c b (dp,ar(nb,*),in) - matrix b
c na (int,sc,in) - number of rows in matrix a
c nb (int,sc,in) - number of rows in matrix b
c nc (int,sc,in) - number of rows in matrix c
c n1 (int,sc,in) - number of rows in matrix c to fill
c n2 (int,sc,in) - number of columns in matrix c to fill
c n3 (int,sc,in) - number of rows in matrix a and
c number of rows of matrix b
c to work with (the two need
c to be the same for the inner product)
c if n3 is negative, accumulate results in c
c output arguments:
c c (dp,ar(nc,*),out) - product matrix c
c *** mpg C = A+ B if n3 > 0
c C = C + A+ B if n3 < 0
c A(na,*) B(nb,*) C(nc,*) C:minor n1 * n2 n3: dot length
c
4.4.6. Subroutine maat (Changing a Matrix Value via Addition, Multiplication, and
Transposition)
*deck,maat
subroutine maat(a,c, nc,n, con)
c primary function: does con*a*at and sums the result onto c (a is a vector)
c *** Notice - This file contains ANSYS Confidential information ***
c typ=int,dp,log,chr,dcp siz=sc,ar(n) intent=in,out,inout
c input arguments:
c a (dp,ar(*),in) - vector to be multiplied by itself to
c generate an nxn square matrix
c (a by a-transposed)
c c (dp,ar(nc,*),inout) - matrix to be accumulated onto
c nc (int,sc,in) - number of rows in the c matrix
c n (int,sc,in) - size of square matrix
c con (dp,sc,in) - multiplier on above square matrix
c output arguments:
c c (dp,ar(nc,*),inout) - matrix to be accumulated onto
c only the lower triangular matrix is done
c Note: this routine is usually followed by matsym,
c to do the complete matrix
c
4.4.7. Subroutine matba (Updating Matrix Value via Transposition, Multiplications, and
Addition)
*deck,matba
subroutine matba (a,b,c,na,nb,nc,n1,n2,work,con)
c primary function: does con(at*b*a) and sums the result
c
c *** Notice - This file contains ANSYS Confidential information ***
c input arguments:
c a (dp,ar(na,*),in) - matrix a
c b (dp,ar(nb,*),in) - matrix b (must be square,
c and maximum dimension is (15,15)
c c (dp,ar(nc,*),inout)- matrix c (see output)
c na (int,sc,in) - number of rows in matrix a
c nb (int,sc,in) - number of rows in matrix b
c nc (int,sc,in) - number of rows in matrix c
c n1 (int,sc,in) - number of rows in matrix a and
c number of rows of matrix b
c to work with (the two need
c to be the same for the inner product)
c n2 (int,sc,in) - number of columns in matrix c to fill
c con (dp,sc,in) - multiplier on product added to sum
c output arguments:
c c (dp,ar(nc,*),inout)- c = c + con*at*b*a
c work (dp,ar(n2,*),out) - at*b (this byproduct is occasionally useful)
c *** C = C + con A+ B A A(na,*) B(nb,*) C(nc,*) C:minor n1 * n2
c see matbabd for block diagonal
c
4.4.8. Subroutine matsym (Filling the Upper Triangle from the Lower Triangle)
*deck,matsym
subroutine matsym (a,nd,n)
c primary function: fill upper triangle from lower triangle
c *** Notice - This file contains ANSYS Confidential information ***
c typ=int,dp,log,chr,dcp siz=sc,ar(n) intent=in,out,inout
c input arguments:
c a (dp,ar(nd,*),inout) - matrix to have its lower triangular part
c copied to its upper triangular part
c nd (int,sc,in) - number of rows of the a matrix
c n (int,sc,in) - size of matrix to be processed
c output arguments:
c a (dp,ar(nd,*),inout) - matrix that has its lower triangular part
c copied to its upper triangular part
c
4.4.9. Subroutine mctac (Transposing a symmetric matrix)
*deck,mctac
subroutine mctac (a,na,c,nc,nold,nnew)
c **** function: do a = c(transpose) * a * c , where a is symmetric **
c *** Notice - This file contains ANSYS Confidential information ***
c input arguments:
c a (dp,ar(na,na),inout) matrix to be pre and post multiplied
c (part operated on must be
c square(nold x nold) and symmetric)
c na (int,sc,in) first dimension of the a matrix
c c (dp,ar(nc,nnew),in) matrix to pre and post multiply a by
c (part used may be rectangular(nold x nnew))
c nc (int,sc,in) first dimension of the c matrix
c nold (int,sc,in) size of part of 'A' matrix that is
c to be processed(input size). maximum = 64
c nnew (int,sc,in) size of part of 'A' matrix that
c results from this operation(output size).
c maximum = 64
c output arguments:
c a (dp,ar(na,na),inout) resulting matrix
c (still square(nnew x nnew) and symmetric).
4.4.10. Subroutine tran (Transposing a matrix)
*deck,tran
subroutine tran (zs,tr,nz,ntr,nrow,irot)
c primary function: perform tr-transpose * zs * tr ************
c *** Notice - This file contains ANSYS Confidential information ***
c input arguments:
c variable (typ,siz,intent) description
c zs (dp,ar(nz,nz),inout) - matrix to be transformed
c tr (dp,ar(ntr,ntr),in) - transformation matrix
c nz (int,sc,in) - dimensioned size of zs matrix
c ntr (int,sc,in) - dimensioned size of tr matrix
c nrow (int,sc,in) - number of rows of zs matrix to transform
c irot (int,sc,in) - block size to transform(size of tr matrix)
c output arguments:
c variable (typ,siz,intent) description
c zs (dp,ar(nz,nz),inout) - transformed matrix
4.4.11. Subroutine symeqn (Solving Simultaneous Linear Equations)
*deck,symeqn
function symeqn (a,nd,n,nc,defFlag)
c
c primary function: solve a set of simultaneous linear equations
c
c secondary functions: invert a matrix
c
c NOTE: this routine assumes that the matrix to be solved or
c inverted is positive or negative definite. This routine
c also assumes that the diagonals are all non-zero. If
c this assumption is not true, use isimeq.F.
c
c *** Notice - This file contains ANSYS Confidential information ***
c
c input arguments:
c variable (typ,siz,intent) description
c a (dp,ar(nd,*),inout) - matrix to be solved or inverted
c second dimension must be at least:
c n + abs(nc)
c nd (int,sc,in) - first dimension of the a matrix
c n (int,sc,in) - number of equations
c nc (int,sc,in) - number of additional columns.
c if nc = +n or -n, invert n x n matrix and
c put result in the n+1 to 2xn columns.
c if nc is 0 or negative, nc will be reset to
c n and then symeqn will set up identity
c matrix after the input matrix, where the
c result of the inversion will be put.
c if nc is positive and less than n, do a
c partial inversion. see example 1 below.
c defFlag (int,sc,in) - flag indicating that incoming matrix MUST be:
c -1 - negative definite
c 0 - positive or negative definite
c 1 - positive definite
c
c output arguments:
c variable (typ,siz,intent) description
c symeqn (in,sc,out) - 0 - non-singular matrix
c 1 - singular matrix
c 2 - near-singular matrix
c a (dp,ar(nd,*),inout) - results or inverted matrix.
c starts in column n+1.
c note: original information is destroyed.
c
c example 1: Solve three simultaneous linear equations:
c i = symeqn (a(1,1),3,3,1)
c calling routine has a dimensioned as a(3,4)
c each equation has its 3 coefficents in the first 3 columns,
c and the constant term is in the fourth column.
c solution is in fourth column.
c
c example 2: Invert a 3x3 matrix:
c i = symeqn (a(1,1),3,3,-3)
c calling routine has a dimensioned as a(3,6)
c input matrix was input in first 3 columns
c output matrix in ouput in last 3 columns