---
title: "matT(): function in Types, TypeShade API reference"
description: "matT, a function in Types. Any matCxR<f32> or matCxR<f64>: cols columns of rows components each, column-major as both targets are."
url: https://typeshade.dev/api/matt/
language: en
---

# `matT()`

Function in Types

Any matCxR<`f32`> or matCxR<`f64`>: cols columns of rows components each, column-major as both targets are.

`import { matT } from 'typeshade/core/ir'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
const matT: (
  cols: 2 | 3 | 4,
  rows: 2 | 3 | 4,
  elem?: "f32" | "f64",
) => Extract<ShaderType, { kind: "mat"; }>
```

## Parameters

**`cols` `2 | 3 | 4`**

Number of columns — the `C` of `matCxR`.

**`rows` `2 | 3 | 4`**

Number of rows — the `R` of `matCxR`, and the component count of one column.

**`elem` optional `'f32' | 'f64'`**

`'f32'` for a native matrix, `'f64'` for the emulated-double one (square only).

## Return value

`Extract<ShaderType, { kind: 'mat' }>`

## Description

The named constants above are the shapes with a spelling of their own; this is how the front end and a host build the other six.

## Examples

### Example

```ts
import { typeKey } from 'typeshade'
import { matT } from 'typeshade/core/ir'

typeKey(matT(2, 3)) // 'mat2x3<f32>'
```

## Source

[`src/core/ir/types/matrix-types.ts`, line 38](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/types/matrix-types.ts#L38), at commit af54ddad5
