This section describes functions from file la.ct.
[x] = Tr(A)
Tr(A) computes the trace of a square array A,
that is, the sum of A[i,i,...]. If A is scalar,
it is returned as is.
Error codes:
-1: Nonnumeric input arg
-2: Array rank is less than 2
-3: Input array is not square
[d] = det(A)
det(A) returns the determinant of a square matrix A.
A may be integer, real or complex valued.
If A is scalar, it is returned as such.
Error codes:
-1: Nonnumeric input arg
-2: Input array is not a matrix
-3: Input matrix is not square
-4: Singular matrix
[A] = eye(n)
eye(n) returns the (integer) unit matrix of order n.
n must be a non-negative scalar integer.
eye(V) where V is a two-element integer vector with
both elements equal and positive works also, thus
you can also use eye(size(A)).
Error codes:
-1: Argument not an integer or IntArray
-2: Negative dimension
-3: IntArray rank not 1
-4: IntArray length not 2
-5: Integer vector elements are unequal
[B] = inv(A)
inv(A) returns the inverse of a square matrix A.
A may be integer, real or complex valued.
A may also be a scalar, in which case its reciprocal
is returned.
Error codes:
-1: Nonnumeric input arg
-2: Input array is not a matrix
-3: Input matrix is not square
-4: Singular matrix
-5: Singular matrix
[C] = matprod(A,B; Aflag,Bflag)
matprod(A,B) returns the matrix product of A and B.
If at least one of A and B is scalar, matprod(A,B) is the
same as their ordinary product A*B. If both A and B
are arrays, their "inner" dimensions must agree.
That is, the last dimension of A must equal the first
dimension of B.
You can abbreviate matprod(A,B) as A**B.
Optional args: matprod(A,B,aflag,bflag) can be used to
transpose or Hermitian-conjugate the factors before the
product. 'n' means no operation, 't' means transpose and
'h' means Hermitian conjugate. For example,
matprod(A,B,'h') = A'**B = herm(A)**B
matprod(A,B,'n','t') = A**B.' = A**transpose(B)
Normally you need not use matprod explicitly, but you
can use the operator **, which is internally translated
to matprod. Hermitian conjugates and transposes in
connection with ** produce the corresponding 'h' and
't' options in matprod. For example,
A'**B generates matprod(A,B,'h')
A.'**B' generates matprod(A,B,'t','h')
A**B.' generates matprod(A,B,'n','t')
and so on. The runtime is optimal for all these operations.
Error codes:
-1: Inner dimensions do not agree
-2: Resulting array would have too high rank
-3: Third arg not one of 'n', 't', 'h'
-4: Fourth arg not one of 'n', 't', 'h'
Next Chapter, Previous Chapter
Table of contents of this chapter, General table of contents
Top of the document, Beginning of this Chapter