File: index.md

package info (click to toggle)
pd-iemmatrix 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,576 kB
  • sloc: ansic: 15,440; makefile: 291; sh: 169
file content (87 lines) | stat: -rw-r--r-- 2,014 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
title: "A quick introduction to iemmatrix"
# the lower the weight, the earlier it is sorted
weight: 1
draft: false
---

## hello world

A *matrix* is a two-dimensional array of numbers.

*iemmatrix* uses a special {{<pdmsg matrix >}} message to send matrices from one object to another.
This message consists of the selector `matrix` followed by the number of *rows* and *columns*, and finally the data in row-major order:

$$
\texttt{[matrix   2 3  10 20 30  40 50 60(}
\to
\begin{pmatrix}
10 & 20 & 30 \cr
40 & 50 & 60
\end{pmatrix}
$$


![first patch](1.pd.svg)

The actual message format usually does not need to concern the user,
as matrices are created and processed by specialized objects.



## creating special matrices

The {{< pdobj mtx >}} object understands messages to create some special matrices:


![create special matrices](2.pd.svg)

There's also a number of specialized objects to create these matrices, e.g.
{{< pdobj mtx_ones >}}, {{< pdobj mtx_zeros >}},
{{< pdobj mtx_eye >}}, {{< pdobj mtx_egg >}},
{{< pdobj mtx_diag >}}, {{< pdobj mtx_diegg >}}
and {{< pdobj mtx_rand >}}.


## binary operators
![binops](3.pd.svg)

The {{< pdobj "mtx_+" >}}, {{< pdobj "mtx_-" >}},
{{< pdobj "mtx_.*" >}}, {{< pdobj "mtx_./" >}},
{{< pdobj "mtx_.^" >}},
{{< pdobj "mtx_>" >}}, {{< pdobj "mtx_>=" >}},
{{< pdobj "mtx_<" >}}, {{< pdobj "mtx_<=" >}},
{{< pdobj "mtx_==" >}} & {{< pdobj "mtx_!=" >}}
{{< pdobj "mtx_&&" >}} and {{< pdobj "mtx_||" >}},
{{< pdobj "mtx_&" >}} and {{< pdobj "mtx_|" >}}
objects all perform element-wise operations.
The operations are the same as their Pd-vanilla non-matrix counterparts.


For proper matrix multiplication use {{< pdobj "mtx_*" >}}.


## basic manipulation

![basic manipulation](4.pd.svg)

## advanced manipulation

![advanced manipulation](5.pd.svg)


## Examples

### finding the maximum, replacing it with -777

![finding the maximum](6.pd.svg)


### lin-swept sine

![lin-swept sine](7.pd.svg)


### simple peak picker

![simple peak picker](8.pd.svg)