# idct#

ivy.idct(x, /, *, type=2, n=None, axis=-1, norm=None, out=None)[source]#

Compute the 1D Inverse Discrete Cosine Transformation of a given signal.

Parameters:
• x (`Union`[`Array`, `NativeArray`]) – The input signal.

• type (`Literal`[`1`, `2`, `3`, `4`], default: `2`) – The type of the idct. Must be 1, 2, 3 or 4.

• n (`Optional`[`int`], default: `None`) – The length of the transform. If n is less than the input signal length, then x is truncated, if n is larger then x is zero-padded.

• axis (`int`, default: `-1`) – The axis to compute the IDCT along.

• norm (`Optional`[`Literal`[`'ortho'`]], default: `None`) – The type of normalization to be applied. Must be either None or “ortho”.

• out (`Optional`[`Union`[`Array`, `NativeArray`]], default: `None`) – optional output array, for writing the result to.

Return type:

`Union`[`Array`, `NativeArray`]

Returns:

• ret – Array containing the transformed input.

• Both the description and the type hints above assumes an array input for simplicity,

• but this function is nestable, and therefore also accepts `ivy.Container`

• instances in place of any of the arguments.

Examples

With `ivy.Array` input:

```>>> x = ivy.array([8, 16, 24, 32, 40, 48, 56, 64])
>>> y = ivy.idct(x, type=2, n=None, norm='ortho')
>>> print(y)
ivy.array([ 79.49862671, -70.37691498,  30.00390816, -23.58938599,
13.92713165, -10.078475  ,   5.19664812,  -1.95411837])
```
```>>> x = ivy.array([[[8, 16, 24, 32], [40, 48, 56, 64]],
...                [[1,  2,  3,  4], [ 5,  6,  7,  8]]])
>>> y = ivy.idct(x, type=1, n=None, axis=0, norm=None)
>>> print(y)
ivy.array([[[ 9., 18., 27., 36.],
[45., 54., 63., 72.]],
```
[[ 7., 14., 21., 28.],

[35., 42., 49., 56.]]])

```>>> x = ivy.array([[ 8.1, 16.2, 24.3, 32.4],
...                [40.5, 48.6, 56.7, 64.8]])
>>> y = ivy.zeros((2, 4), dtype=ivy.float32)
>>> ivy.idct(x, type=1, n=None, norm=None, out=y)
>>> print(y)
ivy.array([[ 1.21500000e+02, -3.24000015e+01,  1.90734863e-06,
-8.10000420e+00],
[ 3.15899994e+02, -3.24000053e+01,  3.81469727e-06,
-8.09999847e+00]])
```
```>>> x = ivy.array([8., 16., 24., 32., 40., 48., 56., 64.])
>>> ivy.idct(x, type=4, n=None, norm=None, out=x)
>>> print(x)
ivy.array([279.4135742, -279.6779785, 128.3770599, -114.8719864,
83.72109985, -79.52869415, 69.79182434, -68.72489166])
```

With one `ivy.Container` input:

```>>> x = ivy.Container(a=ivy.array([8, 16, 24, 32, 40, 48, 56, 64]),
...                   b=ivy.array([1,  2,  3,  4,  5,  6,  7,  8]))
>>> y = ivy.idct(x, type=3, n=None, norm='ortho')
>>> print(y)
{
a: ivy.array([1.01823380e+02, -5.15385818e+01, 1.36371466e-06, -5.38763905e+00,
0.00000000e+00, -1.60722279e+00, -8.80319249e-08,
-4.05617893e-01]),
b: ivy.array([1.27279224e+01, -6.44232273e+00, 1.70464332e-07, -6.73454881e-01,
0.00000000e+00, -2.00902849e-01, -1.10039906e-08,
-5.07022366e-02])
}
```

With multiple `ivy.Container` inputs:

```>>> x = ivy.Container(a=ivy.array([8, 16, 24, 32, 40, 48, 56, 64]),
...                   b=ivy.array([1,  2,  3,  4,  5,  6,  7,  8]))
>>> container_n = ivy.Container(a=9, b=4)
>>> container_type = ivy.Container(a=2, b=1)
>>> container_norm = ivy.Container(a="ortho", b=None)
>>> y = ivy.idct(x, type=container_type, n=container_n, norm=container_norm)
>>> print(y)
{
a: ivy.array([86.29723358, -66.69506073, 9.93914604, 2.88008881,
-16.18951607, 18.06697273, -17.57439613, 11.68861485,
-4.41308832]),
b: ivy.array([1.50000000e+01, -4.00000000e+00, -2.22044605e-16,
-1.00000000e+00])
}
```
Array.idct(self, /, *, type=2, n=None, axis=-1, norm=None, out=None)[source]#

ivy.Array instance method variant of ivy.idct. This method simply wraps the function, and so the docstring for ivy.idct also applies to this method with minimal changes.

Parameters:
• self (`Array`) – The input signal.

• type (`Literal`[`1`, `2`, `3`, `4`], default: `2`) – The type of the idct. Must be 1, 2, 3 or 4.

• n (`Optional`[`int`], default: `None`) – The length of the transform. If n is less than the input signal length, then x is truncated, if n is larger than x is zero-padded.

• norm (`Optional`[`Literal`[`'ortho'`]], default: `None`) – The type of normalization to be applied. Must be either None or “ortho”.

• out (`Optional`[`Array`], default: `None`) – optional output array, for writing the result to.

Return type:

`Array`

Returns:

ret – Array containing the transformed input.

Examples

```>>> x = ivy.array([8., 16., 24., 32., 40., 48., 56., 64.])
>>> x.idct(type=2, norm="ortho")
ivy.array([ 79.49862671, -70.37691498,  30.00390816, -23.58938599,
13.92713165, -10.078475  ,   5.19664812,  -1.95411837])
```
Container.idct(self, /, *, type=2, n=None, axis=-1, norm=None, out=None)[source]#

ivy.Container instance method variant of ivy.idct. This method simply wraps the function, and so the docstring for ivy.idct also applies to this method with minimal changes.

Parameters:
• self (`Container`) – Container with the input signals.

• type (`Union`[`Literal`[`1`, `2`, `3`, `4`], `Container`], default: `2`) – The type of the idct. Must be 1, 2, 3 or 4.

• n (`Optional`[`Union`[`int`, `Container`]], default: `None`) – The length of the transform. If n is less than the input signal length, then x is truncated, if n is larger then x is zero-padded.

• norm (`Optional`[`Union`[`Literal`[`'ortho'`], `Container`]], default: `None`) – The type of normalization to be applied. Must be either None or “ortho”.

• out (`Optional`[`Container`], default: `None`) – optional output container, for writing the result to.

Return type:

`Container`

Returns:

ret – The transformed input.

Examples

```>>> x = ivy.Container(a=ivy.array([8, 16, 24, 32, 40, 48, 56, 64]),
...                   b=ivy.array([1,  2,  3,  4,  5,  6,  7,  8]))
>>> x.idct(type=2, norm='ortho')
{
a: ivy.array([79.49862671, -70.37691498, 30.00390816, -23.58938599,
13.92713165, -10.078475, 5.19664812, -1.95411837]),
b: ivy.array([9.94, -8.79711437, 3.76, -2.94867325, 1.74089146,
-1.25980937, 0.64958102, -0.2442648])
}
```