.. highlightlang:: us .. index:: sum .. _sum: sum === .. us.tag sum ENGLISH STR math-base :ref:`sum` computes the sum of all elements for a real or complex vector. Strings from string vectors will be appended to a scalar string. When the argument is a matrix, a row vector will be created containing the sum of the matrix columns. .. function:: mSum = sum(m) .. us.return **Return Value** *mSum* is a scalar if *m* is a vector. The scalar contains the sum of vector elements. If *m* is a matrix, *mSum* is a row vector. The row vector's columns contain the sum of matrix rows *m*. .. us.params **Parameters** .. uparam:: m *m* is a real, complex or string matrix. .. us.comment **Comment** There is a set of functions in UniScript which edit their arguments columnwise when it is a matrix: i.e. :ref:`all`, :ref:`any`, :ref:`max`, :ref:`min`. .. us.example **Example** :: * m = rand(4,3) * m 0.3237 0.3530 0.3255 0.3244 0.1540 0.3401 0.4934 0.5662 0.8952 0.2887 0.8207 0.3366 * sum(m) 1.4302 1.8939 1.8974 * sum(sum(m)) 5.2215 .. seealso:: :ref:`overview-mathematic` :sub:`id-1974292`