({{, ASUM[x] 
computes the sum of the absolute values of elements of the vector x.}})

OpenersNotesSection(Spacer1)Details

To use ASUM, you first need to load the BLAS Package using (RefLink[Needs, paclet:ref/Needs])["LinearAlgebra`BLAS`"].

The following argument must be given:

For complex vectors x, ASUM computes the total of the sum of the absolute values of the real and imaginary parts taken separately.

OpenersPrimaryExamplesSection(Spacer1)Examples  (7)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Load the BLAS package:

Needs["LinearAlgebra`BLAS`"]

Compute the sum of absolute values of elements of an integer vector:

ASUM[{1,-2,3,-4}]

OpenersExampleSection1(Spacer1)Scope  (4)

A real vector:

ASUM[{-2.1,3.2,4.3,-5.9}]

A complex vector:

ASUM[{1+I,-2-I,-3+2I,1-4*I}]

An arbitrary-precision vector:

ASUM[{1`20,-2,3,-4}]

A symbolic vector:

ASUM[{v1,v2,v3}]

OpenersExampleSection3(Spacer1)Properties & Relations  (2)

ASUM[x] is equivalent to (RefLink[Apply, paclet:ref/Apply])[(RefLink[Plus, paclet:ref/Plus]),(RefLink[Abs, paclet:ref/Abs])[x]] for non-complex x:

x=RandomReal[{-1,1},{5}];
ASUM[x]==Apply[Plus,Abs[x]]

ASUM[x] is equivalent to (RefLink[Apply, paclet:ref/Apply])[(RefLink[Plus, paclet:ref/Plus]),(RefLink[Abs, paclet:ref/Abs])[(RefLink[Re, paclet:ref/Re])[x]]]+(RefLink[Apply, paclet:ref/Apply])[(RefLink[Plus, paclet:ref/Plus]),(RefLink[Abs, paclet:ref/Abs])[(RefLink[Im, paclet:ref/Im])[x]]] for complex or symbolic x:

x=RandomComplex[{-1-I,1+I},{5}];
ASUM[x]==Apply[Plus,Abs[Re[x]]]+Apply[Plus,Abs[Im[x]]]

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Basic Linear Algebra Subroutines, paclet:LowLevelLinearAlgebra/guide/BLASGuide])}})}})