Function Repository Resource:

# AntidiagonalMatrix

Creates an antidiagonal matrix by given the antidiagonal

Contributed by: Sander Huisman
 ResourceFunction["AntidiagonalMatrix"][list] gives a matrix with the elements of list on the leading antidiagonal, and 0 elsewhere. ResourceFunction["AntidiagonalMatrix"][list,k] gives a matrix with the elements of list on the kth antidiagonal. ResourceFunction["AntidiagonalMatrix"][list,k,n] pads with 0s to create an n×n matrix.

## Details and Options

ResourceFunction["AntidiagonalMatrix"][list] creates a matrix where the antidiagonal is given by the elements xi of list:
For positive k, ResourceFunction["AntidiagonalMatrix"][list,k] puts the elements k positions above the main antidiagonal. ResourceFunction["AntidiagonalMatrix"][list,-k] puts the elements k positions below.
AntidiagonalMatrix[list,k] fills the kth antidiagonal of a square matrix with the elements from list. Different values of k lead to different matrix dimensions.
ResourceFunction["AntidiagonalMatrix"][list,k,n] always creates an n×n matrix, even if this requires dropping elements of list.
AntidiagonalMatrix[list,k,{m,n}] creates an m×n matrix.
ResourceFunction["AntidiagonalMatrix"][SparseArray[…],…] gives a SparseArray object.

## Examples

### Basic Examples (3)

Construct an antidiagonal matrix:

 In[1]:=
 Out[1]=

A super-antidiagonal matrix:

 In[2]:=
 Out[2]=

A sub-antidiagonal matrix:

 In[3]:=
 Out[3]=

### Scope (4)

The elements in AntidiagonalMatrix are chosen to match the elements of the vector:

 In[4]:=

Exact number entries:

 In[5]:=
 Out[5]=

Machine-number entries:

 In[6]:=
 Out[6]=

Arbitrary-precision number entries:

 In[7]:=
 Out[7]=

When the vector is a SparseArray object, AntidiagonalMatrix will give a SparseArray object:

 In[8]:=
 Out[8]=
 In[9]:=
 Out[9]=

Pad with zeros to make a larger square matrix:

 In[10]:=
 Out[10]=

Make a square matrix with the specified dimension:

 In[11]:=
 Out[11]=

Rectangular diagonal matrices:

 In[12]:=
 Out[12]=
 In[13]:=
 Out[13]=

### Applications (3)

Express a matrix as the sum of its antidiagonal and off-antidiagonal parts:

 In[14]:=
 Out[14]=
 In[15]:=
 Out[17]=

Construct a 5×5 tri-antidiagonal matrix:

 In[18]:=
 Out[19]=

Extract the antidiagonal from an antidiagonal rectangular matrix:

 In[20]:=
 Out[21]=

Reconstruct the original matrix from the antidiagonal:

 In[22]:=
 Out[22]=

### Properties and Relations (1)

Using the resource function Antidiagonal with AntidiagonalMatrix gives the original vector:

 In[23]:=
 Out[24]=

SHuisman

## Version History

• 1.0.0 – 03 July 2019