⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mat

📁 Calc Software Package for Number Calc
💻
📖 第 1 页 / 共 2 页
字号:
	rows is matmax(A,1) - matmin(A,1) + 1; the number of columns if	matmax(A,2) - matmin(A,2) + 1.	A matrix is said to be square	if it is two-dimensional and the number of rows is equal to the	number of columns.    A * B	Multiplication is defined provided certain conditions by the	dimensions and shapes of A and B are satisfied.	 If both have	dimension 2 and the column-index-list for A is the same as	the row-index-list for B, C = A * B is defined in the usual	way so that for i in the row-index-list of A and j in the	column-index-list for B,		C[i,j] =  Sum A[i,k] * B[k,j]	the sum being over k in the column-index-list of A.  The same	formula is used so long as the number of columns in A is the same	as the number of rows in B and k is taken to refer to the offset	from matmin(A,2) and matmin(B,1), respectively, for A and B.	If the multiplications and additions required cannot be performed,	an execution error may occur or the result for C may contain	one or more error-values as elements.	If A or B has dimension zero, the result for A * B is simply	that of multiplying the elements of the other matrix on the	left by A[] or on the right by B[].	If both A and B have dimension 1, A * B is defined if A and B	have the same size; the result has the same index-list as A	and each element is the product of corresponding elements of	A and B.  If A and B have the same index-list, this multiplication	is consistent with multiplication of 2D matrices if A and B are	taken to represent 2D matrices for which the off-diagonal elements	are zero and the diagonal elements are those of A and B.	the real and complex numbers.	If A is of dimension 1 and B is of dimension 2, A * B is defined	if the number of rows in B is the same as the size of A.  The	result has the same index-lists as B; each row of B is multiplied	on the left by the corresponding element of A.	If A is of dimension 2 and B is of dimension 1, A * B is defined	if number of columns in A is the same as the size of A.	 The	result has the same index-lists as A; each column of A is	multiplied on the right by the corresponding element of B.	The algebra of additions and multiplications involving both one-	and two-dimensional matrices is particularly simple when all the	elements are real or complex numbers and all the index-lists are	the same, as occurs, for example, if for some positive integer n,	all the matrices start as  mat [n]  or	mat [n,n].    det(A)	If A is a square, det(A) is evaluated by an algorithm that returns	the determinant of A if the elements of A are real or complex	numbers, and if such an A is non-singular, inverse(A) returns	the inverse of A indexed in the same way as A.	For matrix A of	dimension 0 or 1, det(A) is defined as the product of the elements	of A in the order in which they occur in A, inverse(A) returns	a matrix indexed in the same way as A with each element inverted.    The following functions are defined to return matrices with the same	index-ranges as A and the specified operations performed on all	elements of A.	Here num is an arbitrary complex number (nonzero	when it is a divisor), int an integer, rnd a rounding-type	specifier integer, real a real number.	    num * A	    A * num	    A / num	    - A	    conj(A)	    A << int, A >> int	    scale(A, int)	    round(A, int, rnd)	    bround(A, int, rnd)	    appr(A, real, rnd)	    int(A)	    frac(A)	    A // real	    A % real	    A ^ int    If A and B are one-dimensional of the same size dp(A, B) returns	their dot-product, i.e. the sum of the products of corresponding	elements.    If A and B are one-dimension and of size 3, cp(A, B) returns their	cross-product.    randperm(A) returns a matrix indexed the same as A in which the elements	of A have been randomly permuted.    sort(A) returns a matrix indexed the same as A in which the elements	of A have been sorted.    If A is an lvalue whose current value is a matrix, matfill(A, v)	assigns the value v to every element of A, and if also, A is	square, matfill(A, v1, v2) assigns v1 to the off-diagonal elements,	v2 to the diagonal elements.  To create and assign to A the unit	n * n matrix, one may use matfill(mat A[n,n], 0, 1).    For a square matrix A, mattrace(A) returns the trace of A, i.e. the	sum of the diagonal elements.  For zero- or one-dimensional A,	mattrace(A) returns the sum of the elements of A.    For a two-dimensional matrix A, mattrans(A) returns the transpose	of A, i.e. if A is mat[m,n], it returns a mat[n,m] matrix with	[i,j] element equal to A[j,i].	For zero- or one-dimensional A,	mattrace(A) returns a matrix with the same value as A.    The functions search(A, value, start, end]) and    rsearch(A, value, start, end]) return the first or last index i    for which A[[i]] == value and start <= i < end, or if there is    no such index, the null value.   For further information on default    values and the use of an "accept" function, see the help files for    search and rsearch.    reverse(A) returns a matrix with the same index-lists as A but the    elements in reversed order.    The copy and blkcpy functions may be used to copy data to a matrix from    a matrix or list, or from a matrix to a list.  In copying from a    matrix to a matrix the matrices need not have the same dimension;    in effect they are treated as linear arrays.EXAMPLE    ; obj point {x,y}    ; mat A[5] = {1, 2+3i, "ab", mat[2] = {4,5}, obj point = {6,7}}    ; A    mat [5] (5 elements, 5 nonzero):      [0] = 1      [1] = 2+3i      [2] = "ab"      [3] = mat [2] (2 elements, 2 nonzero)      [4] = obj point {6, 7}    ; print A[0], A[1], A[2], A[3][0], A[4].x    1 2+3i ab 4 6    ; define point_add(a,b) = obj point = {a.x + b.x, a.y + b.y}    point_add(a,b) defined    ; mat [B] = {8, , "cd", mat[2] = {9,10}, obj point = {11,12}}    ; A + B    mat [5] (5 elements, 5 nonzero):      [0] = 9      [1] = 2+3i      [2] = "abcd"      [3] = mat [2] (2 elements, 2 nonzero)      [4] = obj point {17, 19}    ; mat C[2,2] = {1,2,3,4}    ; C^10    mat [2,2] (4 elements, 4 nonzero):      [0,0] = 4783807      [0,1] = 6972050      [1,0] = 10458075      [1,1] = 15241882    ; C^-10    mat [2,2] (4 elements, 4 nonzero):      [0,0] = 14884.650390625      [0,1] = -6808.642578125      [1,0] = -10212.9638671875      [1,1] = 4671.6865234375    ; mat A[4] = {1,2,3,4}, A * reverse(A);    mat [4] (4 elements, 4 nonzero):      [0] = 4      [1] = 6      [2] = 6      [3] = 4LIMITS    The theoretical upper bound for the absolute values of indices is    2^31 - 1, but the size of matrices that can be handled in practice will    be limited by the availability of memory and what is an acceptable    runtime.  For example, although it may take only a fraction of a    second to invert a 10 * 10 matrix, it will probably take about 1000    times as long to invert a 100 * 100 matrix.LINK LIBRARY    n/aSEE ALSO    ismat, matdim, matmax, matmin, mattrans, mattrace, matsum, matfill,    det, inverse, isident, test, config, search, rsearch, reverse, copy,    blkcpy, dp, cp, randperm, sort## Copyright (C) 1999-2006  Landon Curt Noll#### Calc is open software; you can redistribute it and/or modify it under## the terms of the version 2.1 of the GNU Lesser General Public License## as published by the Free Software Foundation.#### Calc is distributed in the hope that it will be useful, but WITHOUT## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY## or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU Lesser General## Public License for more details.#### A copy of version 2.1 of the GNU Lesser General Public License is## distributed with calc under the filename COPYING-LGPL.  You should have## received a copy with calc; if not, write to Free Software Foundation, Inc.## 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.#### @(#) $Revision: 29.7 $## @(#) $Id: mat,v 29.7 2006/06/25 22:16:55 chongo Exp $## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/mat,v $#### Under source code control:	1991/07/21 04:37:22## File existed as early as:	1991#### chongo <was here> /\oo/\	http://www.isthe.com/chongo/## Share and enjoy!  :-)	http://www.isthe.com/chongo/tech/comp/calc/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -