2 mattrace - trace of a square matrix
8 m square matrix with summable diagonal elements
10 return determined by addition of elements
13 For a two-dimensional square matrix, mattrace(m) returns the sum of
14 the elements on the principal diagonal. In particular, if m
15 has been created by mat m[N,N] where N > 0, mattrace(m) returns
17 m[0,0] + m{1,1] + ... + m[N-1,N-1]
20 ; mat m[2,2] = {1,2,3,4}
21 ; print mattrace(m), mattrace(m^2)
33 ## Copyright (C) 1999 Landon Curt Noll
35 ## Calc is open software; you can redistribute it and/or modify it under
36 ## the terms of the version 2.1 of the GNU Lesser General Public License
37 ## as published by the Free Software Foundation.
39 ## Calc is distributed in the hope that it will be useful, but WITHOUT
40 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
41 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
42 ## Public License for more details.
44 ## A copy of version 2.1 of the GNU Lesser General Public License is
45 ## distributed with calc under the filename COPYING-LGPL. You should have
46 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
47 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
49 ## @(#) $Revision: 30.1 $
50 ## @(#) $Id: mattrace,v 30.1 2007/03/16 11:10:42 chongo Exp $
51 ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/mattrace,v $
53 ## Under source code control: 1997/09/06 20:03:35
54 ## File existed as early as: 1997
56 ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
57 ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/