# ?lamrg

Creates a permutation list to merge the entries of two independently sorted sets into a single set sorted in acsending order.

## Syntax

call slamrg( n1, n2, a, strd1, strd2, index )

call dlamrg( n1, n2, a, strd1, strd2, index )

## Description

The routine creates a permutation list which will merge the elements of a (which is composed of two independently sorted sets) into a single set which is sorted in ascending order.

## Input Parameters

n1, n2

  INTEGER. These arguments contain the respective lengths of the two sorted lists to be merged.

a

  REAL for slamrg

  DOUBLE PRECISION for dlamrg.

  Array, DIMENSION (n1+n2).

  The first n1 elements of a contain a list of numbers which are sorted in either ascending or descending order. Likewise for the final n2 elements.

strd1, strd2

  INTEGER.

  These are the strides to be taken through the array a. Allowable strides are 1 and -1. They indicate whether a subset of a is sorted in ascending (`strdx = 1`) or descending (`strdx = -1`) order.

## Output Parameters

index

  INTEGER. Array, DIMENSION (n1+n2).

  On exit, this array will contain a permutation such that if `b(i) = a(index(i))` for `i=1`, `n1+n2`, then b will be sorted in ascending order.

Parent topic: Auxiliary Routines