({{, SYR[ul,α,x,a] 
computes the symmetric rank-one update a+α (RefLink[Outer, paclet:ref/Outer])[(RefLink[Times, paclet:ref/Times]),x,x] and resets the appropriate part of a to the result.}})

OpenersNotesSection(Spacer1)Details

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

The following arguments must be given:

The upper/lower triangular string ul may be specified as:

Dimensions of the matrix and vector arguments must be such that the dot product and addition are well defined.

OpenersPrimaryExamplesSection(Spacer1)Examples  (8)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Load the BLAS package:

Needs["LinearAlgebra`BLAS`"]

Apply a symmetric rank-one update to the upper triangular part of a matrix:

a={{1,-2},{-2,3}};
SYR["U",1,{1,2},a];
a

OpenersExampleSection1(Spacer1)Scope  (4)

Real matrix and vectors:

a={{-2.1,0.,3.2},{4.3,0.2,-0.3},{4.1,2.6,0.}};
SYR["U",0.5,{-1.2,0.,2.3},a];
a

Complex matrix and vectors:

a={{2.1+0.5I,3.2+I},{4.1I,3.8}};
SYR["L",1.0,{2.3,3.4I},a];
a

Arbitrary-precision matrix and vectors:

a={{1`20,-2},{-2,3}};
SYR["U",1`20/2,{1`20,2},a];
a

Integer-symbolic matrix and vectors:

a={{m11,m12},{m21,m22}};
SYR["U",α,{x1,x2},a];
a

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

SYR["U",α,x,a] is equivalent to a=a+α (RefLink[Outer, paclet:ref/Outer])[(RefLink[Times, paclet:ref/Times]),x,x] for the upper triangular part of a:

a=a1=RandomReal[1,{5,5}];
x=RandomReal[1,{5}];
α=RandomReal[];
SYR["U",α,x,a];
a==UpperTriangularize[α Outer[Times,x,x]]+a1

The strictly lower triangular part of a is unchanged:

LowerTriangularize[a,-1]==LowerTriangularize[a1,-1]

OpenersExampleSection4(Spacer1)Possible Issues  (2)

The last argument must be a symbol:

SYR["U",1/2,{-2,1},{{1,2},{3,4}}]

The last argument must be initialized to a matrix:

Clear[a];
SYR["U",1/2,{-2,1},a]

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