LinearAlgebra`BLAS`
LinearAlgebra`BLAS`

SWAP

SWAP[x,y]

swaps contents of the vectors x and y.

Details and Options

  • To use SWAP, you first need to load the BLAS Package using Needs["LinearAlgebra`BLAS`"].
  • The following arguments must be given:
  • xinput/output symbolvector; the symbol value is modified in place
    yinput/output symbolvector; the symbol value is modified in place
  • SWAP[x,y] is equivalent to {x,y}={y,x}.
  • The vector arguments must be of the same length.

Examples

open allclose all

Basic Examples  (1)

Load the BLAS package:

Swap two vectors :

Scope  (4)

Real vectors:

Complex vectors:

Arbitrary-precision vectors:

Symbolic vectors:

Generalizations & Extensions  (2)

Swap the first two rows of a matrix in place:

Swap the second and third columns of a matrix in place:

Properties & Relations  (1)

SWAP[x,y] is equivalent to {x,y}={y,x}:

Possible Issues  (3)

The arguments must be symbols:

The arguments must be initialized to vectors:

The arguments must be of equal length:

Wolfram Research (2017), SWAP, Wolfram Language function, https://reference.wolfram.com/language/LowLevelLinearAlgebra/ref/SWAP.html.

Text

Wolfram Research (2017), SWAP, Wolfram Language function, https://reference.wolfram.com/language/LowLevelLinearAlgebra/ref/SWAP.html.

CMS

Wolfram Language. 2017. "SWAP." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/LowLevelLinearAlgebra/ref/SWAP.html.

APA

Wolfram Language. (2017). SWAP. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/LowLevelLinearAlgebra/ref/SWAP.html

BibTeX

@misc{reference.wolfram_2024_swap, author="Wolfram Research", title="{SWAP}", year="2017", howpublished="\url{https://reference.wolfram.com/language/LowLevelLinearAlgebra/ref/SWAP.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_swap, organization={Wolfram Research}, title={SWAP}, year={2017}, url={https://reference.wolfram.com/language/LowLevelLinearAlgebra/ref/SWAP.html}, note=[Accessed: 21-November-2024 ]}