1 Introduction

Recently, a team led by R. Stanley Williams from the Hewlett-Packard Company announced the fabrication of a nanometer-size memristor, a contraction for memory resistor [15], which was postulated in [1, 2]. This passive electronic device has generated unprecedented worldwide interests because of its potential applications [12, 16] in next generation computers and powerful brain-like “neural” computers. One immediate application offers an enabling low-cost technology for nonvolatile memories where future computers would turn on instantly without the usual ‘booting time”, currently required in all personal computers. Another important application is the construction of artificial neural networks [14].

Cellular automaton [17] is a modeling and simulation tool in computer science, mathematics, physics, chemistry, biology, etc. It consists of a grid of cells, where each cell has a finite number of states. Every cell has the same rule for updating, based on the states of neighboring cells. Cellular automata can exhibit many emergent phenomena; such as fractals, chaos, randomness, auto waves, etc. Many one-dimensional cellular automata can be classified empirically into one of the four qualitative classes: homogeneous state, stable or periodic structures, chaotic pattern, and complex localized structures, sometimes long-lived [17]. Thus, cellular automata can explain how simple rules can generate complex results [5, 17].

Recently, Wolfman’s fundamental research was further developed and extended by Leon O. Chua from the perspective of neural networks [5]. In this cellular automaton, the dynamics of the universal neuron  is defined by a nonlinear difference equation (or a differential equation), having one or two nested absolute-value functions, and eight adjustable parameters. The universal neuron can generate all possible rules of one-dimensional cellular automata by adjusting these parameters.

Cellular Neural Network (CNN) [3, 4]  is a dynamic nonlinear system defined by coupling only identical simple dynamical systems, called cells, located within a prescribed sphere of influence, such as nearest neighbors. Because of its simplicity, and ease for chip (hardware) implementation, CNN has found numerous applications in Image and Video Signal Processing, Robotic and Biological Visions, and Higher Brain Functions. It is a well-known fact that for many brainlike computations, the CNN universal chip [3, 8] is far superior to any equivalent DSP implementation by at least three orders of magnitude in either speed, power, or area. The CNN has the ability to mimic high level brain functions. Many well-known visual illusions have been simulated by CNN image processing [3, 4, 7, 8, 10].

In this paper, we design a cellular automaton and a cellular neural network using nonlinear passive memristors. We first propose a basic memristor cell, which can perform logical operations: “AND”, “OR”, “XOR”, and “XNOR”. We next design a memristor cellular automaton by adding some circuit elements to the basic cell, and we show that the memristor cellular automaton can exhibit some complex behaviors, and also perform image processing applications. We next design a memristor discrete-time cellular neural network (memristor DTCNN), which can perform many image processing operations and higher brain functions. We also show that by modifying the characteristics of memristors, the memristor DTCNN can perform almost all functions of memristor cellular automaton. Furthermore, it can perform more than one functions at the same time. Thus it allows multitasking.

2 Cellular Automata

A one-dimensional cellular automaton consists of a row of cells and a set of rules. Each cell can be in one of two states – black or white. Each cell has three neighbors (counting itself), so there are \(2^{3}=8\) possible patterns for a neighborhood, and there are \(2^{8}=256\) possible rules. Consider the rules defining the following cellular automaton:

  1. 1.

    if all three of these cells are white, then the new state of the cell will be white.

  2. 2.

    if all three of the cells are black, then the new state of the cell will also be white.

  3. 3.

    in any other case, the new state of the cell will be black.

Below is the table defining this rule.

$$\begin{aligned} \begin{array}{c} \text{ Rule } \text{126 } \\ \begin{array}{|c|c|c|c|c|c|c|c|c|} \hline \text{ current } \text{ pattern } &{} 111 &{} 110 &{} 101 &{} 100 &{} 011 &{} 010 &{} 001 &{} 000 \\ \hline \text{ new } \text{ state } \text{ for } \text{ center } \text{ cell } &{} 0 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 0 \\ \hline \end{array} \end{array} \end{aligned}$$
(1)

Here, the symbols “1” and “0” denote “black” and “white”, respectively. For example, if three adjacent cells currently have the pattern 100 (left cell is black, middle and right cells are white), then the middle cell will become 1 (black) on the next time step. Since 126 is written “01111110” in binary representation, the above rule is referred to as “rule 126”.

Let us rewrite the truth table of rule 126 in terms of its equivalent decimal representations.

(2)

where \(x_{i}(t)\) denotes a state variable of cell “i” at the discrete-time t. Note that each cell “i” is coupled only to its left neighbor cell \((i-1)\), and right neighbor cell \((i+1)\). From this table, we obtain the relation

$$\begin{aligned} x_{i}(t+1) = {\left\{ \begin{array}{ll} 0 &{} \text {if } \ w = 0, \ 7, \\ 1 &{} \text {if } \ w = 1, \ 2, \ 3, \ 4, \ 5, \ 6, \end{array}\right. } \end{aligned}$$
(3)

where

$$\begin{aligned} w {\mathop {=}\limits ^{\triangle }} x_{i-1}(t) \bullet 2^{2} + x_{i}(t) \bullet 2^{1} + x_{i+1}(t) \bullet 2^{0}. \end{aligned}$$
(4)

Observe that Rule 126 can be generated by the difference equation

$$\begin{aligned} x_{i}(t+1) = u \left( \Bigl | w(w -7) \Bigl | \right) = {\left\{ \begin{array}{ll} 0 &{} \text {if } \ w = 0, \ 7, \\ 1 &{} \text {if } \ w = 1, \ 2, \ 3, \ 4, \ 5, \ 6, \end{array}\right. } \end{aligned}$$
(5)

where u(x) is a unit step function defined by

$$\begin{aligned} u(x)= {\left\{ \begin{array}{ll} 1, &{} x > 0, \\ 0, &{} x = 0, \\ 0, &{} x < 0. \\ \end{array}\right. } \end{aligned}$$
(6)
Fig. 1
figure 1

The unit step function u(x) satisfying \(u(0)=0\)

In this paper, u(x) is defined as a piecewise constant function satisfying \(u(0)=0\) (see Fig. 1).

Rule 126 can also be generated by the distinct but equivalent difference equation

$$\begin{aligned} x_{i}(t+1) = u (|w|) - u(|w|-6), \end{aligned}$$
(7)

or

$$\begin{aligned} x_{i}(t+1) = u \Big ( floor (|w|) \Bigr ) - u \Bigl ( floor (|w|)- 6 \Bigr ), \end{aligned}$$
(8)

where floor(x) indicates the largest integer not greater than x (see Fig. 2). We use the floor function to design memristor cellular automata in the latter section.

Fig. 2
figure 2

The floor function floor(x)

3 Cellular Neural Networks

Cellular Neural Network (CNN) [3, 4] is a dynamic nonlinear system defined by coupling only identical simple dynamical systems, called cells, located within a prescribed sphere of influence, such as nearest neighbors. The dynamics of a standard cellular neural network with a neighborhood of radius r are governed by a system of \(n=MN\) differential equations

$$\begin{aligned} \begin{array}{c} \displaystyle \frac{dx_{ij}}{dt} = - \gamma x_{ij}+ \sum _{k,l \in N_{ij}} ( a_{k,l} \ y_{kl}+b_{k,l} \ u_{kl}) + z_{ij}, \\ (i,j) \in \{ 1, \ldots , M \} \times \{ 1, \ldots , N \} \end{array} \end{aligned}$$
(9)

where \(N_{ij}\) denotes the r-neighborhood of cell \(C_{ij}\), and \(a_{kl}, b_{kl}\), and \(z_{ij}\) denote the feedback, control and threshold template parameters, respectively. The matrices \(A= [ a_{kl} ]\) and \(B= [ b_{kl} ]\) are referred to as the feedback template A and the feedforward (input) template B, respectively. The output \(y_{ij}\) and the state \(x_{ij}\) of each cell are usually related via the piecewise-linear saturation function

$$\begin{aligned} y_{ij}=f(x_{ij})= \frac{1}{2} \Bigl ( |x_{ij}+1|-|x_{ij}-1| \Bigr ). \end{aligned}$$
(10)

If we restrict the neighborhood radius of every cell to 1, assume that \(z_{ij}\) is the same for the whole network, and set \(\gamma = 1\) for the sake of simplicity, the template \(\{ A, B, z \}\) is fully specified by 19 parameters, which are the elements of two \(3 \times 3\) matrices A and B, namely

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline a_{-1, -1} &{} a_{-1, 0} &{} a_{-1,1} \\ \hline a_{0, -1} &{} a_{0, 0} &{} a_{0,1} \\ \hline a_{1, -1} &{} a_{1, 0} &{} a_{1,1} \\ \hline \end{array} \ , \ \ \ B = \begin{array}{|c|c|c|} \hline b_{-1, -1} &{} b_{-1, 0} &{} b_{-1,1} \\ \hline b_{0, -1} &{} b_{0, 0} &{} b_{0,1} \\ \hline b_{1, -1} &{} b_{1, 0} &{} b_{1,1} \\ \hline \end{array} \ , \end{aligned}$$
(11)

and a real number z.

Approximating the time derivate of Eq. (9) by the formula

$$\begin{aligned} \frac{dx_{ij}}{dt} = \frac{x_{ij}(t + \Delta t) - x_{ij}(t) }{\Delta t}, \end{aligned}$$
(12)

we obtain

$$\begin{aligned} \begin{array}{c} \displaystyle \frac{x_{ij}(t + \Delta t) - x_{ij}(t)}{\Delta t} = - \gamma x_{ij}(t) + \sum _{k,l \in N_{ij}} \Bigl ( a_{k,l} \ y_{kl} (t) + b_{k,l} \ u_{kl} \Bigr )+z_{ij}, \\ (i,j) \in \{ 1, \ldots , M \} \times \{ 1, \ldots , N \} \end{array} \end{aligned}$$
(13)

If we set \(\Delta t = 1\), we would obtain

$$\begin{aligned} x_{ij}(t + 1) = c \ x_{ij}(t) + \sum _{k,l \in N_{ij}} \Bigl ( a_{k,l} \ y_{kl} (t) + b_{k,l} \ u_{kl} \Bigr )+z_{ij}, \ \end{aligned}$$
(14)

where \(c {\mathop {=}\limits ^{\triangle }} 1 - \gamma \). By setting \(c = 0\) (that is, \(\gamma = 1\)), we obtain the discrete-time recursive equation

$$\begin{aligned} \displaystyle x_{ij}(t+1) = \sum _{k,l \in N_{ij}} \Bigl ( a_{k,l} \ y_{kl}(t) + b_{k,l} \ u_{kl} \Bigr ) + z_{ij}, \end{aligned}$$
(15)

where \(t=0, \ 1, \ 2, \ \ldots \) and

$$\begin{aligned} y_{ij}(t)=f(x_{ij}(t)) = \frac{1}{2} \Bigl ( |x_{ij}(t)+1|-|x_{ij}(t)-1| \Bigr ). \end{aligned}$$
(16)

Equation (15) is called the discrete-time CNN (DTCNN) [4], and it can be transformed into the form

$$\begin{aligned} \displaystyle y_{ij}(t+1) = f \left( \sum _{k,l \in N_{ij}} \Bigl ( a_{k,l}y_{kl}(t) + b_{k,l}u_{kl} \Bigr )+z_{ij} \right) . \end{aligned}$$
(17)
Fig. 3
figure 3

A charge-controlled memristor (left). A flux-controlled memristor (right)

4 Memristor

Memristor [1, 2] in Fig. 3 is a passive 2-terminal electronic device which is described by a nonlinear constitutive relation

$$\begin{aligned} v=M(q)i \ \ \text {or} \ \ i=W( \varphi )v, \end{aligned}$$
(18)

between the device terminal voltage v and the terminal current i. The two nonlinear functions M(q) and \(W( \varphi )\), called the memristance and memductance, respectively, are defined by

$$\begin{aligned} M(q) {\mathop {=}\limits ^{\triangle }}\frac{d\varphi (q)}{dq} \ \ \text {and} \ \ W(\varphi ) {\mathop {=}\limits ^{\triangle }} \frac{dq(\varphi )}{d\varphi }, \end{aligned}$$
(19)

representing the slope of scalar functions

$$\begin{aligned} \varphi = \varphi (q) \ \ \text {and} \ \ q=q( \varphi ), \end{aligned}$$
(20)

respectively, called the memristor constitutive relation (see Fig. 4).

Fig. 4
figure 4

The constitutive relation of a monotone-increasing piecewise-linear memristor: (left) charge-controlled memristor, (right) flux-controlled memristor

The fundamental relation between q and i (resp. \(\varphi \) and v) is given by

$$\begin{aligned} i = \frac{dq}{dt} \left( \text {resp. } v = \frac{d\varphi }{dt} \right) \end{aligned}$$
(21)

A memristor characterized by a differentiable \(q-\varphi \) (resp. \(\varphi -q\)) characteristic curve is passive if, and only if, its small-signal memristance M(q) (resp. small-signal memductance \(W(\varphi )\)) is non-negative; i.e.,

$$\begin{aligned} M(q)=\frac{d\varphi (q)}{dq} \ge 0 \ \left( \text{ resp. } \ W(\varphi )=\frac{dq(\varphi )}{d\varphi } \ge 0 \right) \end{aligned}$$
(22)

(see [1]). In this paper, we call them “memristance” and “memductance” for short. Since the instantaneous power dissipated by the above memristor is given by

$$\begin{aligned} p(t)= M \bigl ( q(t) \bigr ) \ i(t)^{2} \ge 0, \end{aligned}$$
(23)

or

$$\begin{aligned} p(t)= W \bigl ( \varphi (t) \bigr ) \ v(t)^{2} \ge 0, \end{aligned}$$
(24)

the energy flow into the memristor from time \(t_{0}\) to t satisfies

$$\begin{aligned} \int _{t_{0}}^{t} p( \tau ) d \tau \ge 0, \end{aligned}$$
(25)

for all \(t \ge t_{0}\). Thus, the memristor is passive.

Note that the memristor was generalized to memristive systems in [2]. These systems are being developed for application in nanoelectronic memories, computer logic, neuromorphic computer architectures, and chaotic oscillators [9, 14].

5 Memristor Cell

The memristor cellular automaton we propose in this paper consists of an \(M \times N\) rectangular array of memristor cells C(ij) with Cartesian coordinate \((i, j), \ i=1, 2, \ \ldots , M, \ j=1, 2, \ \ldots , N\). All cells and their interconnections are assumed to be identical.

5.1 Basic Cell

A basic memristor cell C(ij) consists of a passive memristor and a switch as shown in Fig. 5. A current pulse generator provides a pulse wave \(I_{p}\) to memristors and switches in all memristor cells. A pulse wave \(I_{p}\) consists of positive-negative paired current pulses. A switch is turned on when (and only when) a positive current pulse is applied to the cell as shown in Fig. 5. A switching frequency f is given by

$$\begin{aligned} f = \frac{1}{T}, \end{aligned}$$
(26)

where T is a period of the pulse wave.

Referring to Eq. (18), we obtain the cell output \(y_{ij}(t)\)

$$\begin{aligned} y_{ij}(t)= {\left\{ \begin{array}{ll} v(t) = M \bigl ( q(t) \bigr ) \times I_{p}(t), &{} I_{p} > 0, \\ 0, &{} I_{p} < 0. \end{array}\right. } \end{aligned}$$
(27)

Therefore, if we apply a positive current pulse \(I_{p}(t)\) with a height of 1 and a width of 1 into the memristor, that is,

$$\begin{aligned} \left. \begin{array}{lll} I_{p}(t) &{}=&{} 1, \\ q(t) &{}=&{} \displaystyle \int _{0}^{t} I_{p}(t) \ dt = \displaystyle \int _{0}^{t} 1 \ dt= t, \end{array} \right\} \end{aligned}$$
(28)

for \(0 \le t \le 1\), we would obtain

$$\begin{aligned} v(t) = M \bigl ( q(t) \bigr ) \times I_{p}(t) = M \bigl ( q(t) \bigr ) \times 1 = M \bigl ( q(t) \bigr ). \end{aligned}$$
(29)

Thus, we can measure (read) the memristance M(q(t)) from the voltage v(t) across the memristor by applying a positive current pulse \(I_{p}(t)\) to the cell. Note that negative current pulses in Fig. 5 are used to discharge the memristor (that is, to reset the charge of the memristor), which is stored in the memristor by positive current pulses. If the negative current pulses are not applied to the cell, the charge of the memristor continues to increase as shown in Fig. 6.

Fig. 5
figure 5

A basic memristor cell C(ij) which consists of a memristor and a switch (top). A current pulse generator provides a current pulse wave (\(I_{p}\)) to a memristor and a switch. The pulse wave \(I_{p}\) consists of positive-negative paired current pulses (middle). A switch is turned on when (and only when) a positive current pulse is applied to the cell (bottom)

Fig. 6
figure 6

Switching sequence for a current pulse and a charge q of the memristor. a A current pulse \(I_{p}\) consists of positive-negative paired current pulses. b The switch is turned on when (and only when) a positive current pulse is applied. c The negative current pulse discharges the memristor. d The charge of the memristor continues to increase if the negative current pulses are not applied to the cell

Fig. 7
figure 7

A memristor cell C(ij) with an input \(u_{ij}\) (a voltage-controlled current source). A diamond-shape symbol denotes a voltage-controlled current source, whose output current has the same value as the controlled voltage \(u_{ij}\)

Fig. 8
figure 8

A passive charge-controlled memristor (top). A memristance M(q) (bottom left) and a \(q-\varphi \) characteristic curve of a passive charge-controlled memristor (bottom right) are illustrated

Fig. 9
figure 9

XOR operation. Time sequences of the current pulse \(I_{p}\), input \(u_{i j}\), charge \(q_{ij}\), and cell output \(y_{i j}\) are illustrated from top to bottom. The cell generates an output pulse when \(1 \le q_{ij} \le 2\) and \(I_{p}=1\)

5.2 Logical Operations

In order to realize logical operations, we consider a memristor cell with an input as shown in Fig. 7. The characteristic of the memristor is illustrated in Fig. 8. The input current \(u_{ij}\) is applied to the cell by a voltage-controlled current source, whose output current has the same value as the controlled voltage \(u_{ij}\). In this case, each cell C(ij) works independently, since there are no inputs from neighbors.

We next study the response of the cell C(ij) when the input \(u_{ij}\) in Fig. 9 is applied to the cell. The input pulse \(u_{ij}\) consists of positive-negative paired pulses. The negative pulses are used to discharge the memristor, which is stored in the memristor by the positive input pulses. Note the following (see Fig. 9):

  1. 1.

    Positive input pulses must be applied to the cell before a read pulse \(I_{p}\) is applied to the cell.

  2. 2.

    Negative input pulses must be applied to the cell after a read pulse \(I_{p}\) is applied to the cell.

The memristance M(q) illustrated in Fig. 8 is defined by

$$\begin{aligned} M(q)= {\left\{ \begin{array}{ll} 1, &{} 1 \le q \le 2, \\ 0, &{} else. \\ \end{array}\right. } \end{aligned}$$
(30)

From Eqs. (27)–(30), the cell output \(y_{ij}\) is given by

$$\begin{aligned} y_{ij}= {\left\{ \begin{array}{ll} 1, &{} 1 \le q_{ij} \le 2 \text { and } I_{p}>0, \\ 0, &{} else. \\ \end{array}\right. } \end{aligned}$$
(31)

If the charge \(q_{ij}\) satisfies the condition: \(1 \le q_{ij} \le 2\) and \(I_{p}>0\), then the cell generates the output pulse (see Fig. 9). Hence, if we apply the input \(u_{ij}\) corresponding to the sequence “11”, “01”, “00”, and “10” to the cell, we would obtain the output sequence “0”, “1”, “0”, and “1”, respectively. That is, we obtain the table:

(32)

Thus, this cell performs the logical operation “XOR”, which is defined by the following truth table:

(33)
Fig. 10
figure 10

Memristance M(q) for the logical operations AND, OR, XOR and XNOR

Similarly, the memristance M(q) illustrated in Fig. 10 can perform the logical operations “AND”, “OR”, and “XNOR”, which are defined by the following truth tables:

(34)
Fig. 11
figure 11

AND operation. Time sequences of the current pulse \(I_{p}\), input \(u_{i j}\), charge \(q_{ij}\), and cell output \(y_{i j}\) are illustrated from top to bottom. The cell generates an output pulse when \(q_{ij} \ge 2\) and \(I_{p}=1\)

Compare the time sequences of the XOR operation and the AND operation in Figs. 9 and 11. Observe that the only difference between them is the “output sequence”.

The memristance M(q) for the logical operations “AND”, “OR”, “XOR” and “XNOR” can be described by the following even functions:

$$\begin{aligned} \begin{array}{|c|c|} \hline &{} \\ \text {Operation} &{} M(q) \\ &{} \\ \hline &{} \\ AND &{} u \Bigl ( |q| - 2 \Bigr ) \\ &{} \\ OR &{} u \Bigl ( |q| - 1 \Bigr ) \\ &{} \\ XOR &{} u \Bigl ( |q| - 1 \Bigr ) - u \Bigl ( |q| - 2 \Bigr ) \\ &{} \\ XNOR &{} 1 - u \Bigl ( |q| - 1 \Bigr ) - u \Bigl ( |q| - 2 \Bigr ) \\ &{} \\ \hline \end{array} \end{aligned}$$
(35)

Note that there are many distinct but equivalent memristances, which can perform the same logical operations. For example, if we define the memristance \(M_{i}(q)\)

$$\begin{aligned} \begin{array}{lll} M_{0}(q) &{}=&{} {\left\{ \begin{array}{ll} 1, &{} |q|< 1, \\ 0, &{} else, \\ \end{array}\right. } \\ &{}&{} \\ M_{1}(q) &{}=&{} {\left\{ \begin{array}{ll} 1, &{} 1 \le |q|< 2, \\ 0, &{} else, \\ \end{array}\right. } \\ &{}&{} \\ M_{2}(q) &{}=&{} {\left\{ \begin{array}{ll} 1, &{} 2 \le |q|< 3, \\ 0, &{} else, \\ \end{array}\right. } \\ &{}&{} \\ &{}&{} \vdots \\ &{}&{} \\ M_{i}(q) &{}=&{} {\left\{ \begin{array}{ll} 1, &{} i \le q < i+1, \\ 0, &{} else, \\ \end{array}\right. } \end{array} \end{aligned}$$
(36)

the memristance for the logical operation XNOR is given by \(M_{0}(q) + M_{2}(q)\) as shown in Fig. 12.

Fig. 12
figure 12

Characteristic of memristances \(M_{i}(q)\) (\(i=1, \ 2, \ 3\)). The memristance \(M_{0}(q) + M_{2}(q)\) can perform the XNOR operation

Similarly, the memristances for the logical operations “AND”, “OR”, and “XOR” are given by the table:

$$\begin{aligned} \begin{array}{|c|c|} \hline &{} \\ \text {Operation} &{} \text {Memristance} \\ &{} \\ \hline &{} \\ AND &{} M_{2}(q) \\ &{} \\ OR &{} M_{1}(q) + M_{2}(q) \\ &{} \\ XOR &{} M_{1}(q) \\ &{} \\ XNOR &{} M_{0}(q) + M_{2}(q) \\ &{} \\ \hline \end{array} \end{aligned}$$
(37)
Fig. 13
figure 13

A circuit consisting of memristors and switches

Fig. 14
figure 14

A circuit realizing the memristance \(M_{0}(q) + M_{2}(q)\)

5.3 Series Connection of Memristors

Consider the circuit of Fig. 13, which consists of memristors and switches. If two memristors with memristance \(M_{0}(q)\) and \(M_{2}(q)\) are connected in series as shown in Fig. 14, then we have

$$\begin{aligned} v=M_{0}(q)i+M_{2}(q)i=(M_{0}(q)+M_{2}(q))i. \end{aligned}$$
(38)

Thus, two series memristors are equivalent to a single memristor whose memristance is the sum of memristances, that is, \(M_{0}(q)+M_{2}(q)\). It follows that these series memristors can perform the XNOR operation.  We also realize many kinds of memristances by using the circuit in Fig. 13.

Fig. 15
figure 15

A memristor cell C(ij) with asynchronous inputs from eight neighbor cells. Weighting coefficients \( b_{k, \ l} \bigl ( k,\ l \in \{-1, 0, 1 \} \bigl )\) are some constants

5.4 Asynchronous Inputs

Consider the memristor cell with asynchronous inputs from only eight nearest neighbors as shown in Fig. 15. The weighting coefficients \( b_{k, \ l} \ \ \bigl ( k,\ l \in \{-1, 0, 1 \} \bigr )\) are usually listed as entries in the following table:

$$\begin{aligned} B {\mathop {=}\limits ^{\triangle }} \ \begin{array}{|c|c|c|} \hline b_{-1, -1} &{} b_{-1, 0} &{} b_{-1,1} \\ \hline b_{0, -1} &{} b_{0, 0} &{} b_{0,1} \\ \hline b_{1, -1} &{} b_{1, 0} &{} b_{1,1} \\ \hline \end{array} \end{aligned}$$
(39)

Assume that the memristor cell satisfies the conditions:

  1. 1.

    Only two inputs \(u_{i, j}\) and \(u_{i-1, j}\) are available.

  2. 2.

    Effective weighting coefficients \(b_{k, \ l}\) are equal to 1. Thus, the weighting coefficients \( b_{k, \ l}\) can be written as

    $$\begin{aligned} B = \begin{array}{|c|c|c|} \hline b_{-1, -1} &{} b_{-1, 0} &{} b_{-1,1} \\ \hline b_{0, -1} &{} b_{0, 0} &{} b_{0,1} \\ \hline b_{1, -1} &{} b_{1, 0} &{} b_{1,1} \\ \hline \end{array} = \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 1 &{} 1 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \end{aligned}$$
    (40)
  3. 3.

    The memristance M(q) is defined by Eq. (30), that is,

    $$ M(q)= {\left\{ \begin{array}{ll} 1, &{} 1 \le q \le 2, \\ 0, &{} else. \\ \end{array}\right. } $$

Then, by applying the two asynchronous input sequence (the input \(u_{i-1, j}\) precedes the input \(u_{i, j}\)):

$$\begin{aligned} \begin{array}{|c|cc|cc|cc|cc|} \hline u_{i, j} &{} &{} 1 &{} &{} 1 &{} &{} 0 &{} &{} 0 \\ \hline u_{i-1, j} &{} 1 &{} &{} 0 &{} &{} 0 &{} &{} 1 &{} \\ \hline \end{array} \end{aligned}$$
(41)

to this cell, we obtain the output sequence:

$$\begin{aligned} \begin{array}{|c|cc|cc|cc|cc|} \hline \ y_{i, j} \ &{} \ &{} 0 &{} \ &{} 1 &{} \ &{} 0 &{} \ &{} 1 \\ \hline \end{array} \end{aligned}$$
(42)

as shown in Fig. 16.

Fig. 16
figure 16

Time sequences of the memristor cell with two inputs \(u_{i j}\) and \(u_{i-1 j}\). The pulse sequences of inputs \(u_{i j}\) and \(u_{i-1 j}\) indicate the inputs “1100” and “1001”, respectively. The cell generates an output pulse when \(1 \le q_{ij} \le 2\) and \(I_{p}=1\). Thus, we get the output sequence “0101”

That is, we have the following table:

$$\begin{aligned} \begin{array}{|c||cc|cc|cc|cc|} \hline u_{i, j} &{} &{} 1 &{} &{} 1 &{} &{} 0 &{} &{} 0 \\ \hline u_{i-1, j} &{} 1 &{} &{} 0 &{} &{} 0 &{} &{} 1 &{} \\ \hline \hline y_{i, j} &{} &{} 0 &{} &{} 1 &{} &{} 0 &{} &{} 1 \\ \hline \end{array} \end{aligned}$$
(43)

It can realize the truth table of XOR:

$$\begin{aligned} \begin{array}{c} \text{ XOR } \\ \begin{array}{|c|c||c|} \hline u_{i, j} &{} u_{i-1, j}&{} y_{ij} \\ \hline 0 &{} 0 &{} 0 \\ 0 &{} 1 &{} 1 \\ 1 &{} 0 &{} 1 \\ 1 &{} 1 &{} 0 \\ \hline \end{array} \end{array} \end{aligned}$$
(44)

Observe from Fig. 16 that inputs \(u_{i, j}\) and \(u_{i-1, j}\) have different time-frames, which provide timing information.Footnote 1 Therefore, the inputs are not necessarily applied to the cell simultaneously.

Fig. 17
figure 17

A memristor cellular automaton cell, which consists of a memristor cell C(ij) (light green), a current pulse generator (salmon pink), a signal generator (medium purple), and voltage-controlled current sources denoted by a diamond-shape symbol (pink)

6 Memristor Cellular Automaton

We propose a memristor cellular automaton in Fig. 17, which is quite similar to the realization of a cellular neural network (CNN) cell [3, 4]. A memristor cellular automaton consists of a memristor cell \(C(i, \ j)\), a current pulse generator, a signal generator, and voltage-controlled current sources denoted by a pink-colored diamond-shape symbol. A signal generator provides the signal \(z_{ij}(t)\) satisfying the equation

$$\begin{aligned} z_{ij}(t)=y_{ij}(t-T)-y_{ij}(t-2T+1), \end{aligned}$$
(45)

where \(y_{ij}(t-T)\) and \(-y_{ij}(t-2T+1)\) corresponds to a positive pulse and a negative pulse in Fig. 18, respectively.

Fig. 18
figure 18

Time sequences of the memristor cellular automaton. The current pulse \(I_{p}\), output \(y_{i j}\) of cell C(ij), and output \(z_{i j}\) of the signal generator are illustrated from top to bottom

A negative pulse is used to reset the charge of the memristor, stored by a positive pulse. The charge \(q_{ij}(t)\) stored in the memristor during the period \([nT, n T+ \Delta t]\) (\(n=1,2, \ldots \)) is given by

$$\begin{aligned} q_{ij}(nT + \Delta t)&= \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ z_{i+k, \ j+l}(n T) + \Delta t \nonumber \\&= \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \Bigl ( (n-1) T \Bigr ) + \Delta t, \end{aligned}$$
(46)

where \(0< \Delta t < 1\). The last term \(\Delta t\) indicates the charge stored by a positive current pulse (see Fig. 6). Thus, from Eqs. (27) and (29), we have the relation

$$\begin{aligned}&y_{ij}(nT + \Delta t) \nonumber \\&\quad = {\left\{ \begin{array}{ll} \displaystyle M \Bigl ( q_{ij}(nT + \Delta t) \Bigr )= M \left( \sum \limits _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \Bigl ( (n-1) T \Bigr ) + \Delta t \right) , &{} I_{p} > 0, \\ 0, &{} I_{p} < 0. \end{array}\right. } \end{aligned}$$
(47)

We assume that \(M \Bigl ( q_{ij}(nT + \Delta t) \Bigr )\) does not change for \(0< \Delta t < 1\) (that is, the time period when a read pulse is applied to a memristor cell).

6.1 Rule 126 Memristor Cellular Automaton

Consider a cellular automaton, which consists of a one-dimensional array of cells C(i). The local rule 126 was defined by

$$\begin{aligned} \begin{array}{c} \text{ Rule } \text{126 } \\ \begin{array}{|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{} \\ \displaystyle \sum _{k=-1}^{1} \ y_{i+k} \Bigl ( (n-1) T \Bigr ) \times 2^{1-k} &{} 7 &{} 6 &{} 5 &{} 4 &{} 3 &{} 2 &{} 1 &{} 0 \\ &{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ y_{i}( nT ) &{} 0 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 0 \\ &{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(48)

where \(y_{i}( nT )\) denotes a state variable of cell “C(i)” at the discrete-time nT. Applying Eqs. (8)–(47), we can obtain the difference equation:

$$\begin{aligned} \begin{array}{cccc} y_{i}(nT + \Delta t ) &{}=&{} u \left( floor \left( \left| \displaystyle \sum _{k \in (-1, 0, 1)} a_{k} \ y_{i+k} \Bigl ( (n-1) T \Bigr ) + \Delta t \right| \right) \right) \\ &{}&{}&{} \\ &{}&{} \displaystyle -u \left( floor \left( \left| \displaystyle \sum _{k \in (-1, 0, 1)} a_{k} \ y_{i+k} \Bigl ( (n-1) T \Bigr ) + \Delta t \right| - 6 \right) \right) , \\ \end{array} \end{aligned}$$
(49)

where \(I_{p}>0\), and the weighting coefficients \( a_{k} \) and the memristance M(q) are given by

$$\begin{aligned} A {\mathop {=}\limits ^{\triangle }} \begin{array}{|c|c|c|} \hline a_{-1} &{} a_{0} &{} a_{1} \\ \hline \end{array} = \begin{array}{|c|c|c|} \hline 4 &{} 2 &{} 1 \\ \hline \end{array} \ , \end{aligned}$$
(50)

and

$$\begin{aligned} M(q) = u \Bigl ( floor (|q|) \Bigr ) - u \Bigl ( floor (|q|)- 6 \Bigr ), \end{aligned}$$
(51)

respectively. The memristance M(q) can also be written as

$$\begin{aligned} M(q) = \sum _{i=1}^{6}M_{i}(q)= {\left\{ \begin{array}{ll} 0, &{} \text {if } q=0, \ 7, \\ 1, &{} \text {else,} \end{array}\right. } \end{aligned}$$
(52)

where \(M_{i}(q)\) was defined by Eq. (36). Since we apply a positive current pulse to the cell in order to read the memristance M(q) (thus, the charge q(t) is increased by a positive current pulse), the floor functions are inserted into Eq. (51).

Fig. 19
figure 19

Evolution of a rule 126 memristor cellular automaton

The evolution of Eq. (49) is illustrated in Fig. 19, where the two states “1” and “0” are colored “red” and “blue”, respectively.Footnote 2

Since the output \(y_{i} \Bigl ( (n-1)T + \Delta t \Bigr )\) does not change for \(0< \Delta t < 1\), we obtain

$$\begin{aligned} y_{i} \Bigl ( (n-1)T + \Delta t \Bigr )=y_{ij} \Bigl ((n-1)T \Bigr ), \end{aligned}$$
(53)

and

$$\begin{aligned} \begin{array}{l} floor \left( \left| \displaystyle \sum _{k \in (-1, 0, 1)} a_{k} \ y_{i+k} \Bigl ( (n-1) T \Bigr ) \ + \ \Delta t \right| \right) \\ \\ = floor \left( \left| \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k} \ y_{i+k} \Bigl ( (n-1) T \Bigr ) \right| \right) \\ \\ = floor \left( \left| \displaystyle \sum _{k \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \Bigl ( (n-1) T \ + \ \Delta t \Bigr ) \right| \right) \\ \\ = floor \left( \left| \displaystyle \sum _{k \in (-1, 0, 1)} a_{k} \ y_{i+k} \Bigl ( \tau _{n-1} \Bigr ) \right| \right) , \end{array} \end{aligned}$$
(54)

where \(0< \Delta t < 1\) and \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\). Since all state variables \(y_{ij}\) and weighting coefficients \( a_{k, \ l} \) are non-negative integers, the floor functions and absolute functions can be removed from Eq. (49). Thus, we have the equivalent difference equation for rule 126:

$$\begin{aligned} \begin{array}{ccc} y_{i}(\tau _{n}) &{}=&{} u \left( \displaystyle \sum _{k \in (-1, 0, 1)} a_{k} \ y_{i+k} \ ( \tau _{n-1} ) \right) \\ &{}&{} \\ &{}&{} \displaystyle -u \left( \displaystyle \sum _{k \in (-1, 0, 1)} a_{k} \ y_{i+k} \ ( \tau _{n-1} ) - 6 \right) , \end{array} \end{aligned}$$
(55)

or

$$\begin{aligned} y_{i}(\tau _{n}) = \sum _{i=1}^{6} M_{i} \left( \sum _{k \in (-1, 0, 1)} a_{k} \ y_{i+k} \ ( \tau _{n-1} ) \right) . \end{aligned}$$
(56)

6.2 Sierpinski Memristor Cellular Automaton

In a multistate memristor cellular automaton, each cell has one out of m possible states represented by numbers \(0, 1, 2, \ldots , m-1\). For example, a 4-state (or 4-color) Sierpinski cellular automaton can generate Pascal’s triangle and has four states \(\{ 0, \ 1, \ 2, \ 3 \}\) [13]. The rule for this cellular automaton can be written as follows:

$$\begin{aligned} \begin{array}{c} \text {Rule of a 4-state Sierpinski cellular automaton} \\ \begin{array}{|c|c|c||c|} \hline y_{i-1} \ \bigl ( (n-1)T \bigr ) &{} y_{i} \ \bigl ((n-1)T \bigr ) &{} y_{i-1} \ \bigl ((n-1) T \bigr ) + y_{i} \ \bigl ((n-1)T \bigr ) &{} y_{i} \bigl ( nT \bigr ) \\ \hline 0 &{} 0 &{} 0 &{} 0 \\ 0 &{} 1 &{} 1 &{} 1 \\ 0 &{} 2 &{} 2 &{} 2 \\ 0 &{} 3 &{} 3 &{} 3 \\ 1 &{} 0 &{} 1 &{} 1 \\ 1 &{} 1 &{} 2 &{} 2 \\ 1 &{} 2 &{} 3 &{} 3 \\ 1 &{} 3 &{} 4 &{} 0 \\ 2 &{} 0 &{} 2 &{} 2 \\ 2 &{} 1 &{} 3 &{} 3 \\ 2 &{} 2 &{} 4 &{} 0 \\ 2 &{} 3 &{} 5 &{} 1 \\ 3 &{} 0 &{} 3 &{} 3 \\ 3 &{} 1 &{} 4 &{} 0 \\ 3 &{} 2 &{} 5 &{} 1 \\ 3 &{} 3 &{} 6 &{} 2 \\ \hline \end{array} \end{array} \end{aligned}$$
(57)

The memristance and the difference equation which can generate this rule are given by

$$\begin{aligned} M(q) = floor \bigl ( \ |q | \ \bigr ) \ \ (\text {mod} \ 4), \end{aligned}$$
(58)

and

$$\begin{aligned} y_{i}(nT + \Delta t) = floor \left( \ \left| \sum _{k \in (-1, 0, 1)} a_{k} \ y_{i+k} \Bigl ( (n-1) T \Bigr ) + \Delta t \right| \ \right) \ \ (\text {mod} \ 4), \end{aligned}$$
(59)

respectively, where m (mod 4) is the remainder, on division of m by 4, and the weighting coefficient matrix \(A = [a_{k, \ l}] \) is given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline a_{-1} &{} a_{0} &{} a_{1} \\ \hline \end{array} = \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 0 \\ \hline \end{array} \ . \end{aligned}$$
(60)
Fig. 20
figure 20

Evolution of a 4-state Sierpinski memristor cellular automaton 

Evolutions of Eq. (59) is illustrated in Fig. 20. We used the following palette for the state of cells:

$$\begin{aligned} \begin{array}{c} \text{ Color } \text{ palette } \\ \begin{array}{|c|c|c|c|c|} \hline \text{ state } &{} 0 &{} 1 &{} 2 &{} 3 \\ \hline \text{ color } &{} \text {orange} &{} \text {blue} &{} \text {red} &{} \text {green} \\ \hline \end{array} \end{array} \end{aligned}$$
(61)

Since all state variables \(y_{ij}\) and weighting coefficients \( a_{k, \ l} \) are non-negative integers, Eq. (59) can be transformed into an equivalent difference equation

$$\begin{aligned} y_{i}( \tau _{n} ) = \sum _{k \in (-1, 0, 1)} a_{k} \ y_{i+k} \ ( \tau _{n-1} ) \ \ (\text {mod} \ 4), \end{aligned}$$
(62)

where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\).

6.3 Totalistic Two-Dimensional Memristor Cellular Automaton

A totalistic cellular automaton is a special class of cellular automata in which the rules depend on the total values of cells in a neighborhood. The evolution of a totalistic cellular automaton can be described by a table specifying the state of the neighbors (counting itself). Each of the cells can be in one of two states; black (cell value 1) or white (cell value 0). If each cell has nine neighbors (counting itself), there are 10 possible patterns for a neighborhood, and there are \(2^{10}=1024\) possible rules [13].

Consider the following totalistic rules for the two-dimensional cellular automaton with 9-neighbor cells:

$$\begin{aligned} \begin{array}{c} \text{ Rule } \text{797 } \\ \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline \displaystyle \sum _{k=-1}^{1} \sum _{m=-1}^{1} y_{i+k, \ j+m} \Bigl ( (n-1) T \Bigr ) &{} 9 &{} 8 &{} 7 &{} 6 &{} 5 &{} 4 &{} 3 &{} 2 &{} 1 &{} 0 \\ \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ y_{ij}(nT) &{} 1 &{} 1 &{} 0 &{} 0 &{} 0 &{} 1 &{} 1 &{} 1 &{} 0 &{} 1 \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(63)

Since 797 is written “1100011101” in binary representation, the above rule is referred to as “rule 797”. The memristance and the difference equation which can generate this rule are given by

$$\begin{aligned} M(q)&= M_{0}(q)+M_{2}(q)+M_{3}(q)+M_{4}(q)+M_{8}(q)+M_{9}(q) \nonumber \\&= {\left\{ \begin{array}{ll} 1, &{} \text {if } q = 0, 2, 3, 4, 8, 9 \\ 0, &{} \text {if } q = 1, 5, 6, 7, \end{array}\right. } \end{aligned}$$
(64)

and

$$\begin{aligned} y_{ij}(nT + \Delta t) = M \left( \ \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \Bigl ( (n-1) T \Bigr ) + \Delta t \ \right) , \end{aligned}$$
(65)

respectively, and the weighting coefficient matrix \(A = [a_{k, \ l}] \) is given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline a_{-1, -1} &{} a_{-1, 0} &{} a_{-1,1} \\ \hline a_{0, -1} &{} a_{0, 0} &{} a_{0,1} \\ \hline a_{1, -1} &{} a_{1, 0} &{} a_{1,1} \\ \hline \end{array} = \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ . \end{aligned}$$
(66)
Fig. 21
figure 21

Evolution of a rule 797 two-dimensional cellular automaton

Our computer simulation of the totalistic cellular automaton is shown in Fig. 21, where the two states “1” and “0” are colored “yellow” and “blue”, respectively. Observe that it has a complex pattern. Since all state variables \(y_{ij}\) and weighting coefficients \( a_{k, \ l} \) are non-negative integers, Eq. (59) can be transformed into an equivalent difference equation

$$\begin{aligned} y_{ij}( \tau _{n} ) = M \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1} ) \right) , \end{aligned}$$
(67)

where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\).

6.4 Horizontal Hole Detection Memristor Cellular Automaton

Horizontal hole detection cellular automaton detects the number of horizontal holes from each horizontal row of a binary image. A string of adjacent white pixels in a horizontal row is called a horizontal hole if each end is terminated by at least one black pixel [3]. The rule for this cellular automaton can be written as follows:

$$\begin{aligned} \begin{array}{c} \text {Rule of a horizontal hole detection cellular automaton} \\ \begin{array}{|c|c|c|c||c|} \hline y_{i-1, \ j} \ \bigl ( (n-1)T \bigr ) &{} y_{i, \ j} \ \bigl ((n-1)T \bigr ) &{} y_{i+1, \ j} \ \bigl ((n-1) T \bigr ) &{} w &{} y_{i, \ j} \bigl ( nT \bigr ) \\ \hline 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ 0 &{} 0 &{} 1 &{} 1 &{} 0 \\ 0 &{} 1 &{} 0 &{} 2 &{} 1 \\ 0 &{} 1 &{} 1 &{} 3 &{} 0 \\ 1 &{} 0 &{} 0 &{} 4 &{} 1 \\ 1 &{} 0 &{} 1 &{} 5 &{} 0 \\ 1 &{} 1 &{} 0 &{} 6 &{} 1 \\ 1 &{} 1 &{} 1 &{} 7 &{} 1 \\ \hline \end{array} \end{array} \end{aligned}$$
(68)

where ‘1” and “0” in the rule table denote “black” and “white”, respectively, and

$$\begin{aligned} w = y_{i-1, \ j} \ \bigl ( (n-1)T \bigr ) \times 2^{2} + y_{i, \ j} \ \bigl ((n-1)T \bigr ) \times 2^{1} + y_{i+1, \ j} \ \bigl ((n-1) T \bigr ) \times 2^{0}. \end{aligned}$$
(69)

The memristance and the difference equation which can generate this rule are given by

$$\begin{aligned} \begin{array}{lll} M(q) &{}=&{} M_{2}(q) + M_{4}(q) + M_{6}(q) + M_{7}(q) \\ \\ &{}=&{} {\left\{ \begin{array}{ll} 1, &{} q = 2, 4, 6, 7, \\ 0, &{} q = 0, 1, 3, 5, \\ \end{array}\right. } \end{array} \end{aligned}$$
(70)

and

$$\begin{aligned} y_{ij}(nT + \Delta t) = M \left( \ \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \Bigl ( (n-1) T \Bigr ) + \Delta t \ \right) , \end{aligned}$$
(71)

respectively, where the weighting coefficient matrix \(A = [a_{k, \ l}] \) is given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline a_{-1, -1} &{} a_{-1, 0} &{} a_{-1,1} \\ \hline a_{0, -1} &{} a_{0, 0} &{} a_{0,1} \\ \hline a_{1, -1} &{} a_{1, 0} &{} a_{1,1} \\ \hline \end{array} = \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 4 &{} 2 &{} 1 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ . \end{aligned}$$
(72)
Fig. 22
figure 22

A horizontal hole detection memristor cellular automaton. Initial state images and processed images are illustrated from left to right. The number of horizontal holes is indicated by the number of vertical lines on the right images

Our computer simulation of the horizontal hole detection cellular automaton is shown in Fig. 22. Observe that the horizontal holes are detected by this cellular automaton. Similarly, the weighting coefficient matrix \(A = [a_{k, \ l}] \) for vertical hole detection is given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline a_{-1, -1} &{} a_{-1, 0} &{} a_{-1,1} \\ \hline a_{0, -1} &{} a_{0, 0} &{} a_{0,1} \\ \hline a_{1, -1} &{} a_{1, 0} &{} a_{1,1} \\ \hline \end{array} = \begin{array}{|c|c|c|} \hline 0 &{} 4 &{} 0 \\ \hline 0 &{} 2 &{} 0 \\ \hline 0 &{} 1 &{} 0 \\ \hline \end{array} \ . \end{aligned}$$
(73)

Since all state variables \(y_{ij}\) and weighting coefficients \( a_{k, \ l} \) are non-negative integers, Eq. (71) can be transformed into an equivalent difference equation

$$\begin{aligned} y_{ij}(\tau _{n}) = M \left( \ \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \Bigl ( \tau _{n-1} \Bigr ) + \Delta t \ \right) , \end{aligned}$$
(74)

where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\).

6.5 Edge Detection Memristor Cellular Automaton

An edge is a jump in intensity from one pixel to the next.  Define the rule of the edge detection as follows [11]:

  1. 1.

    if the number of black cells is equal to 6, 7, or 8, then the new state of the cell will be black.

  2. 2.

    in any other case, the new state of the cell will be white.

The truth table defining the above edge detection can be written as follows:

$$\begin{aligned} \begin{array}{c} \text {Rule of Edge Detection} \\ \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \displaystyle \sum _{k=-1}^{1} \sum _{m=-1}^{1} y_{i+k, \ j+m} \Bigl ((n-1) T \Bigr ) &{} \ 9 \ &{} \ 8 \ &{} \ 7 \ &{} \ 6 \ &{} \ 5 \ &{} \ 4 \ &{} \ 3 \ &{} \ 2 \ &{} \ 1 \ &{} \ 0 \ \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ y_{ij}(nT) &{} 0 &{} 1 &{} 1 &{} 1 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(75)

where \(y_{ij}(nT)\) has two states \(\{ 0, \ 1 \}\), and “1” and “0” in the rule table denote “black” and “white” of the binary image, respectively. Here, we assumed that there are a few white cells in the neighborhood of an edge. The memristance which can generate the local rule for edge detection is given by

$$\begin{aligned} M(q) = M_{6}(q)+M_{7}(q)+M_{8}(q) = {\left\{ \begin{array}{ll} 0, &{} q = 0, 1, 2, 3, 4, 5, 9, \\ 1, &{} q = 6, 7, 8, \\ \end{array}\right. } \end{aligned}$$
(76)

or

$$\begin{aligned} M(q) = u \Bigl ( floor (|q|)- 5 \Bigr ) -u \Bigl ( floor (|q|)- 8 \Bigr ). \end{aligned}$$
(77)

The difference equation is given by

$$\begin{aligned} \begin{array}{ccc} y_{ij}(nT + \Delta t) &{}=&{} u \left( floor \left| \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \Bigl ( (n-1) T \Bigr ) + \Delta t \right| - 5 \right) \\ &{}&{} \\ &{}&{} \displaystyle -u \left( floor \left| \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \Bigl ( (n-1) T \Bigr ) + \Delta t \right| - 8 \right) , \end{array} \end{aligned}$$
(78)

where the weighting coefficient matrix \(A = [a_{k, \ l}] \) is given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ . \end{aligned}$$
(79)
Fig. 23
figure 23

An edge detection memristor cellular automaton. Initial state images and detected edge images are illustrated from left to right

Our computer simulation of the edge detection cellular automaton is shown in Fig. 23. Observe that the edges of objects are extracted by this cellular automaton.

Since all state variables \(y_{ij}\) and weighting coefficients \( a_{k, \ l} \) are non-negative integers, Eq. (78) can be transformed into an equivalent difference equation

$$\begin{aligned} \begin{array}{ccc} y_{ij}( \tau _{n} ) &{}=&{} u \left( \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1} ) - 5 \right) \\ &{}&{} \\ &{}&{} \displaystyle -u \left( \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1} ) - 8 \right) , \end{array} \end{aligned}$$
(80)

or

$$\begin{aligned} y_{ij}( \tau _{n} ) = \sum _{i=6}^{8} M_{i} \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1} ) \right) , \end{aligned}$$
(81)

where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\).

6.6 Erosion

The basic erosion operator erodes away the boundaries of black pixels in binary images.  Define the rule of the erosion operation as follows [11]:

  1. 1.

    if all cells are black, then the new state of the cell will be black.

  2. 2.

    in any other case, the new state of the cell will be white.

The truth table can be written as follows:

$$\begin{aligned} \begin{array}{c} \text {Rule of Erosion} \\ \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \displaystyle \sum _{k=-1}^{1} \sum _{m=-1}^{1} y_{i+k, \ j+m} \Bigl ((n-1) T \Bigr ) &{} \ 9 \ &{} \ 8 \ &{} \ 7 \ &{} \ 6 \ &{} \ 5 \ &{} \ 4 \ &{} \ 3 \ &{} \ 2 \ &{} \ 1 \ &{} \ 0 \ \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ y_{ij}(nT) &{} 1 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(82)

where \(y_{ij}(nT)\) has two states \(\{ 0, \ 1 \}\), and “1” and “0” in the rule table denote “black” and “white”, respectively. The memristance and the difference equation which can generate the local rule for erosion are given by

$$\begin{aligned} M(q) = u \Bigl ( floor (|q|)- 9 \Bigr ) = {\left\{ \begin{array}{ll} 1, &{} \text {if } |q| \ge 9, \\ 0, &{} \text {else,} \end{array}\right. } \end{aligned}$$
(83)

and

$$\begin{aligned} y_{ij}(nT + \Delta t) = u \left( floor \left| \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \Bigl ( (n-1) T \Bigr ) + \Delta t \right| - 9 \right) , \end{aligned}$$
(84)

respectively, where the weighting coefficient matrix \(A = [a_{k, \ l}] \) is given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ . \end{aligned}$$
(85)
Fig. 24
figure 24

An erosion memristor cellular automaton. Initial state images and erosion images are illustrated from left to right

Our computer simulation of the erosion cellular automaton is shown in Fig. 24. Observe that the boundaries of black pixels in binary images are peeled off by this cellular automaton. Since all state variables \(y_{ij}\) and weighting coefficients \( a_{k, \ l} \) are non-negative integers, Eq. (84) can be transformed into an equivalent difference equation

$$\begin{aligned} y_{ij}(\tau _{n}) = u \left( \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} (\tau _{n-1})- 9 \right) , \end{aligned}$$
(86)

where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\).

6.7 Dilation

The basic dilation operation enlarges the areas of black pixels at their borders in binary images.  Define the rule of totalistic dilation as follows [11]:

  1. 1.

    if all cells are white, then the new state of the cell will be white.

  2. 2.

    in any other case, the new state of the cell will be black.

The truth table can be written as follows:

$$\begin{aligned} \begin{array}{c} \text {Rule of Dilation} \\ \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \displaystyle \sum _{k=-1}^{1} \sum _{m=-1}^{1} y_{i+k, \ j+m} \Bigl ((n-1) T \Bigr ) &{} \ 9 \ &{} \ 8 \ &{} \ 7 \ &{} \ 6 \ &{} \ 5 \ &{} \ 4 \ &{} \ 3 \ &{} \ 2 \ &{} \ 1 \ &{} \ 0 \ \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ y_{ij}(nT) &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 0 \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(87)

where \(y_{ij}(nT)\) has two states \(\{ 0, \ 1 \}\), and “1” and “0” in the rule table denote “black” and “white”, respectively. The memristance and the difference equation which can generate the local rule for dilation are given by

$$\begin{aligned} M(q) = u \Bigl ( floor (|q|) \Bigr ) = {\left\{ \begin{array}{ll} 1, &{} \text {if } |q| \ge 1, \\ 0, &{} \text {else,} \end{array}\right. } \end{aligned}$$
(88)

and

$$\begin{aligned} y_{ij}(nT + \Delta t) = u \left( floor \left| \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \Bigl ( (n-1) T \Bigr ) + \Delta t \right| \right) , \end{aligned}$$
(89)

respectively, where the weighting coefficient matrix \(A = [a_{k, \ l}] \) is given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ . \end{aligned}$$
(90)
Fig. 25
figure 25

A dilation memristor cellular automaton. Initial state images and dilation images are illustrated from left to right

Our computer simulation of the dilation cellular automaton is shown in Fig. 25. Observe that the areas of black pixels at their borders in binary images are enlarged by this cellular automaton. Since all state variables \(y_{ij}\) and weighting coefficients \( a_{k, \ l} \) are non-negative integers, Eq. (89) can be transformed into an equivalent difference equation

$$\begin{aligned} y_{ij}(\tau _{n}) = u \left( \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} (\tau _{n-1}) \right) , \end{aligned}$$
(91)

where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\).

6.8 Laplacian Memristor Cellular Automaton

Consider the Laplacian cellular automaton with eight neighbors [11], whose local rule is given by

$$\begin{aligned} \begin{array}{c} \text {Rule of Laplacian Cellular Automaton} \\ \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ w &{} \ 8 \ &{} \ 7 \ &{} \ \ldots \ &{} \ 2 \ &{} \ 1 \ &{} \ 0 \ &{} \ -1 \ &{} \ -2 \ &{} \ \ldots \ &{} \ -7 \ &{} \ -8 \ \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ y_{ij}(nT) &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(92)

where \(y_{ij}(nT)\) has two states \(\{ 0, \ 1 \}\), “1” and “0” in the rule table denote “black” and “white” in the binary image, respectively, and we set

$$\begin{aligned} w {\mathop {=}\limits ^{\triangle }} \left( \sum _{k=-1}^{1} \sum _{m=-1}^{1} y_{i+k, \ j+m} \ \bigl ( (n-1)T \bigr ) \right) - 9 \ y_{i, \ j} \ \bigl ( (n-1)T \bigr ). \end{aligned}$$
(93)

The memristance and the difference equation which can generate the rule for Laplacian cellular automaton are given by

$$\begin{aligned} M(q) = 1 - u \Bigl ( floor(q) \Bigr ) = {\left\{ \begin{array}{ll} 1, &{} \text {if } q < 1, \\ 0, &{} \text {else,} \end{array}\right. } \end{aligned}$$
(94)

and

$$\begin{aligned} y_{ij}(nT + \Delta t) = 1- u \left( floor \left( \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr )+ \Delta t \right) \right) , \end{aligned}$$
(95)

respectively, where the weighting coefficient matrix \(A = [a_{k, \ l}] \) is given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} -8 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ . \end{aligned}$$
(96)

In this case, the memristance M(q) is not an even function. Our computer simulation of the Laplacian memristor cellular automaton is shown in Fig. 26. Observe that the edges of objects are extracted by this cellular automaton. Note that Eq. (95) can be transformed into an equivalent difference equation

$$\begin{aligned} y_{ij}( \tau _{n} ) = 1- u \left( \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} ( \tau _{n-1} ) \right) , \end{aligned}$$
(97)

where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\).

6.9 Sharpening Filter Memristor Cellular Automaton

Sharpening filters are used to enhance the edges of objects.  It is well known that weighting coefficient matrix \(A = [a_{k, \ l}] \) for a sharpening filter is given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline -1 &{} -1 &{} -1 \\ \hline -1 &{} 9 &{} -1 \\ \hline -1 &{} -1 &{} -1 \\ \hline \end{array} \ . \end{aligned}$$
(98)

Consider the difference equation

$$\begin{aligned} y_{ij}(nT + \Delta t) = u \left( floor \left( \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) -c + \Delta t \right) \right) , \end{aligned}$$
(99)

where c is a constant.

Fig. 26
figure 26

A Laplacian memristor cellular automaton. Initial state images and processed images are illustrated from left to right

Fig. 27
figure 27

A sharpening filter memristor cellular automaton. Initial state grayscale images and processed images are illustrated from left to right. The output binary image is superimposed on a grayscale image

Our computer simulation of the sharpening filter cellular automaton for \(c=30\) is shown in Fig. 27. Observe that the edges of objects are enhanced. In this simulation, the levels of a grayscale image range from 0 (black) to 255 (white), and the output binary image is superimposed on a given grayscale image. Note that Eq. (99) can be transformed into an equivalent difference equation

$$\begin{aligned} y_{ij} ( \tau _{n} )= \ u \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1} ) - c \right) , \end{aligned}$$
(100)

where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\) and c is an integer.

6.10 Noise Removal Memristor Cellular Automaton

Noise removal is a fundamental problem in image analysis.  Let us remove the Gaussian noiseFootnote 3 via the majority rule. The truth table can be written as follows [11]:

$$\begin{aligned} \begin{array}{c} \text {Rule of noise removal} \\ \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \displaystyle \sum _{k=-1}^{1} \sum _{m=-1}^{1} y_{i+k, \ j+m} \Bigl ( (n-1)T \Bigr ) &{} \ 9 \ &{} \ 8 \ &{} \ 7 \ &{} \ 6 \ &{} \ 5 \ &{} \ 4 \ &{} \ 3 \ &{} \ 2 \ &{} \ 1 \ &{} \ 0 \ \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ y_{ij}(nT) &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(101)

where \(y_{ij}(nT)\) has two states \(\{ 0, \ 1 \}\), and “1” and “0” in the rule table denote “black” and “white”, respectively.

The memristance which can generate this rule is given by

$$\begin{aligned} M(q) = \sum _{5}^{9} M_{i}(q) = {\left\{ \begin{array}{ll} 1, &{} \text {if } q=5, 6, 7, 8, 9, \\ 0, &{} \text {else,} \end{array}\right. } \end{aligned}$$
(102)

or

$$\begin{aligned} M(q) = u \Bigl ( floor \bigl ( \ |q|-4 \ \bigr ) \Bigr ) . \end{aligned}$$
(103)

Thus, the difference equation is given by

$$\begin{aligned} y_{i, \ j}(nT + \Delta t) = \sum _{5}^{9} M_{i} \left( \sum _{k, \ l \in (-1, 0, 1)} y_{i+k, \ j+m} \Bigl ( (n-1) T \Bigr )+ \Delta t \right) , \end{aligned}$$
(104)

or

$$\begin{aligned} y_{i, \ j}(nT + \Delta t) = u \left( floor \left( \ \left| \ \sum _{k, \ l \in (-1, 0, 1)} y_{i+k, \ j+m} \Bigl ( (n-1) T \Bigr )+ \Delta t \ \right| \ - 4 \right) \right) , \end{aligned}$$
(105)

where \(0< \Delta t < 1\) and the weighting coefficient matrix \(A = [a_{k, \ l}] \) is given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ . \end{aligned}$$
(106)
Fig. 28
figure 28

A noise removal memristor cellular automaton. Binary images, Gaussian noise images (noise level \(2\%\)), and noise removed images are illustrated from left to right

Our computer simulation of the noise removal memristor cellular automaton is shown in Fig. 28. Observe that the noise is removed by this cellular automaton.

Since all state variables \(y_{ij}\) and weighting coefficients \( a_{k, \ l} \) are non-negative integers, Eqs. (105) and (104) can be transformed into equivalent difference equations

$$\begin{aligned} y_{ij} ( \tau _{n} )= \ u \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1}) - 4 \right) , \end{aligned}$$
(107)

and

$$\begin{aligned} y_{ij} ( \tau _{n} )= \sum _{l=5}^{9} M_{l} \left( \sum _{k, \ l \in (-1, 0, 1)} y_{i+k, \ j+m} ( \tau _{n-1} ) \right) , \end{aligned}$$
(108)

respectively, where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\) and \(0< \Delta t < 1\).

6.11 Inverse Half-Toning Memristor Cellular Automaton

Inverse half-toning is used to convert a binary image into a grayscale image.  The weighting coefficient matrix \(A = [a_{k, \ l}] \), the memristance M(q), and the difference equation for the inverse half-toning are given by

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ , \end{aligned}$$
(109)
$$\begin{aligned} M(q) = floor \left( \ 28 \ |q| \ \right) , \end{aligned}$$
(110)

and

$$\begin{aligned} y_{ij}(nT + \Delta t) = floor \left( \displaystyle 28 \ \left| \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) \right| + \Delta t \right) , \end{aligned}$$
(111)

respectively.Footnote 4

Our computer simulation of Eq. (111) is shown in Fig. 29. Observe that given binary images are converted into grayscale images (10-gradations).Footnote 5

Since all state variables \(y_{ij}\) and weighting coefficients \( a_{k, \ l} \) are non-negative integers, Eq. (111) can be transformed into an equivalent difference equation

$$\begin{aligned} y_{ij} ( \tau _{n} )= \ floor \left( \displaystyle 28 \ \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1} ) \right) , \end{aligned}$$
(112)

where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\).

Fig. 29
figure 29

Inverse half-toning memristor cellular automaton. Initial state binary images (left) are converted into 10-gradations grayscale images (right)

Fig. 30
figure 30

A memristor cellular automaton, which consists of a memristor cell C(ij) (light green), a current pulse generator (salmon pink), a signal generator (medium purple), and voltage-controlled current sources for inputs (light blue) and outputs (pink)

7 Memristor Cellular Automaton with Inputs

Consider memristor cellular automata shown in Figs. 30 and 33. Their dynamics are given by

$$\begin{aligned} y_{ij}( nT )&= M \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) \right. \nonumber \\&\quad \left. + \sum _{k, \ l \in (-1, 0, 1)} b_{k, \ l} \ u_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) + \Delta t \right) , \end{aligned}$$
(113)

and

$$\begin{aligned} y_{ij} ( nT )&= M \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) + \Delta t \right) \nonumber \\&\quad + \sum _{k, \ l \in (-1, 0, 1)} b_{k, \ l} \ u_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ), \end{aligned}$$
(114)

respectively, where M(q) denotes the memristance. Since they have an input term, Eqs. (113) and (114) have a more generalized form than Eq. (47).

Consider next Eq. (49) with a random binary noise input \(r(\tau _{n-1})\):

$$\begin{aligned} \begin{array}{ccc} y_{ij}(\tau _{n}) &{}=&{} u \left( \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1} ) + r( \tau _{n-1} ) \right) \\ &{}&{} \\ &{}&{} \displaystyle \ \ \ -u \left( \displaystyle \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1} ) + r( \tau _{n-1} ) - 6 \right) , \end{array} \end{aligned}$$
(115)

where \(r(\tau _{n-1}) \in \{ 0, 1 \}\). The above equation may be considered to be a special case of Eq. (113), if we set

$$\begin{aligned} M(q)= \Bigl ( floor (|q|) \Bigr ) - u \Bigl ( floor (|q|)- 6 \Bigr ), \end{aligned}$$
(116)

and

$$\begin{aligned} b_{k, \ l} \ u_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) = {\left\{ \begin{array}{ll} r \Bigl ( (n-1) T \Bigr ) &{} \text {if } (k, \ l)=(0, \ 0), \\ 0 &{} \text {else.} \end{array}\right. } \end{aligned}$$
(117)
Fig. 31
figure 31

Evolution of a rule 126 memristor cellular automaton with a random binary noise

Observe that it has complex behavior as shown in Fig. 31.

Fig. 32
figure 32

A memristor discrete-time cellular neural network (DTCNN), which consists of a memristor cell C(ij) (light green), a current pulse generator (salmon pink), a signal generator (medium purple), and voltage-controlled current sources for inputs (light blue), outputs (pink), and a threshold (chocolate)

8 Memristor Discrete-Time Cellular Neural Network

Consider the memristor cell shown in Fig. 32. The dynamics of the cell C(ij) is given by

$$\begin{aligned} y_{ij}( nT )&= M \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) \nonumber \right. \\&\quad \left. + \sum _{k, \ l \in (-1, 0, 1)} b_{k, \ l} \ u_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) + w_{ij} + \Delta t \right) , \end{aligned}$$
(118)

where \(0< \Delta t < 1\).

Fig. 33
figure 33

A memristor cellular automaton, which consists of a memristor cell C(ij) (light green), a current pulse generator (salmon pink), a signal generator (medium purple), a voltage-controlled voltage source for inputs (violet), and voltage-controlled current sources for outputs (pink)

In this cell, a new voltage-controlled current source for a threshold \(w_{ij}\) is connected to the cell \(C(i, \ j)\) of Fig. 33. Thus, the difference between Eqs. (113) and (118) is a threshold parameter \(w_{ij}\). If we assume that

$$\begin{aligned} M(q)=u \Bigl ( float(q) \Bigr ), \end{aligned}$$
(119)

and all state variables \(y_{ij}\) and weighting coefficients \( a_{k, \ l} \), \( b_{k, \ l} \), and \( w_{ij}\) are integers, we would obtain the equation of a memristor discrete-time cellular neural network (Memristor DTCNN)

$$\begin{aligned} y_{ij}( \tau _{n} )= u \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1} ) \ + \sum _{k, \ l \in (-1, 0, 1)} b_{k, \ l} \ u_{i+k, \ j+l} \ ( \tau _{n-1} ) + w_{ij} \right) , \end{aligned}$$
(120)

where \(a_{k, l}, b_{k, l}\), and \(w_{ij}\) denote the feedback, control, and threshold template parameters, respectively. The matrices \(A= [ a_{k, l} ]\) and \(B= [ b_{k, l} ]\) are referred to as the feedback template A and the feedforward (input) template B, respectively. If we assume that \(w_{ij}\) is the same for the whole network, the template \(\{ A, B, w \}\) is fully specified by 19 parameters, which are the elements of two \(3 \times 3\) matrices A, B, and a real number w, namely

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline a_{-1, -1} &{} a_{-1, 0} &{} a_{-1,1} \\ \hline a_{0, -1} &{} a_{0, 0} &{} a_{0,1} \\ \hline a_{1, -1} &{} a_{1, 0} &{} a_{1,1} \\ \hline \end{array} \ , \ \ \ B = \begin{array}{|c|c|c|} \hline b_{-1, -1} &{} b_{-1, 0} &{} b_{-1,1} \\ \hline b_{0, -1} &{} b_{0, 0} &{} b_{0,1} \\ \hline b_{1, -1} &{} b_{1, 0} &{} b_{1,1} \\ \hline \end{array} \ , \ \ \ w = \begin{array}{|c|} \hline const. \\ \hline \end{array} \ \end{aligned}$$
(121)

We remark that CNN and DTCNN can have the output state 1 or \(-1\), however, the memristor DTCNN (120) have the output state 1 or 0. Thus, we may have to modify or adjust CNN templates, which are designed for the output state 1 or \(-1\) [3, 4, 8,9,10].

We next show the relationship between the memristor DTCNN and the memristor cellular automata. The dynamics of DTCNN was given by

$$\begin{aligned} y_{ij}( nT )&= M \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) \right. \nonumber \\&\quad \left. + \sum _{k, \ l \in (-1, 0, 1)} b_{k, \ l} \ u_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) + w_{ij} + \Delta t \right) , \end{aligned}$$
(122)

If we set \(w_{ij}=0\), then we obtain the dynamics of the memristor cellular automata

$$\begin{aligned} y_{ij}( nT )&= M \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) \nonumber \right. \\&\quad \left. + \sum _{k, \ l \in (-1, 0, 1)} b_{k, \ l} \ u_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) + \Delta t \right) , \end{aligned}$$
(123)

Thus, the memristor DTCNN can perform all applications of the memristor cellular automata by modifying the memristance M(q).

8.1 Dilation

The dilation operation enlarges the areas of black pixels at their borders in binary images. Define the template of the dilation operation as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(124)
Fig. 34
figure 34

Dilation memristor DTCNN. Boundaries of black pixels are enlarged. Input images and output images are illustrated from left to right

Our computer simulation of the dilation operation is shown in Fig. 34.  Observe that the boundaries of black pixels in binary images are enlarged. Compare the two templates (90) and (124), the two memristances (88) and (119), and Figs. 25 and 34.

8.2 Erosion

The erosion operator erodes away the boundaries of black pixels in binary images.  Define the template of the erosion operation as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline -8 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(125)
Fig. 35
figure 35

Erosion memristor DTCNN. Boundaries of black pixels are peeled off. Input images and output images are illustrated from left to right

Our computer simulation of the erosion operation is shown in Fig. 35. Observe that the boundaries of black pixels in binary images are peeled off. Compare the two templates (85) and (125), the two memristances (83) and (119), and Figs. 24 and 35.

8.3 Edge Detection

The edge detection operator extracts edges of objects in a given binary image.  Define the template of the edge operation as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} -8 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(126)
Fig. 36
figure 36

Edge detection memristor DTCNN. Edges of objects are extracted. Input images and output images are illustrated from left to right

Our computer simulation of the edge detection is shown in Fig. 36. Observe that edges of objects in a binary image are detected. Compare the two templates (78) and (126), the two memristances (76) and (119), and Figs. 23 and 36.

8.4 Right Edge Detection

The right edge detection operator extracts right edges of all binary objects which are at least two-pixels wide along the horizontal direction in a given binary image. Define the template of the right edge operation as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 1 &{} 1 &{} -1 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline -1 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(127)

Similarly, we can define the template of the left edge detection as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline -1 &{} 1 &{} 1 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline -1 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(128)
Fig. 37
figure 37

Right and left edges detection memristor DTCNN. Right edges and left edges in binary images are detected. Input images, output images of right edge detection, and output images of left edge detection are illustrated from left to right

Our computer simulation of the right edge and left edge detection is shown in Fig. 37. Observe that right and left edges in binary images are detected.

8.5 Face-Vase Illusion

The face-vase illusion operator simulates the well-known visual illusion where the input image is perceived either as two symmetric faces, or as a vase, depending on the initial thought or attention, which is simulated by specifying a small patch of black pixels inside the object to be picked out. Define the template of the face-vase illusion as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 1 &{} 0 \\ \hline 1 &{} 4 &{} 1 \\ \hline 0 &{} 1 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} -6 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(129)
Fig. 38
figure 38

Face-vase illusion memristor DTCNN. Complicated region is picked out by specifying a small patch of black pixels inside the object. Input images, initial states and output images are illustrated from left to right

Our computer simulation of the face-vase illusion is shown in Fig. 38. Observe that the complicated region is picked out by specifying a small patch of black pixels inside the object.

8.6 Shadow Projection

The shadow projection operator projects onto the left the shadow of all objects in a binary image from the right. Define the template of the shadow projection as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 1 &{} 1 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(130)
Fig. 39
figure 39

Shadow projection memristor DTCNN. Shadow of all objects in a binary image is projected onto the left from the right. Input images and output images are illustrated from left to right

Our computer simulation of the shadow projection is shown in Fig. 39. Observe that the shadow of all objects in a binary image is projected onto the left from the right.

8.7 Line Detection

Line detection is a fundamental problem in image analysis. Define the template of the horizontal line and vertical line detections as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline -1 &{} -1 &{} -1 \\ \hline 2 &{} 2 &{} 2 \\ \hline -1 &{} -1 &{} -1 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(131)

and

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline -1 &{} 2 &{} -1 \\ \hline -1 &{} 2 &{} -1 \\ \hline -1 &{} 2 &{} -1 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(132)

respectively.

Fig. 40
figure 40

Line detection memristor DTCNN. An initial state, a detected horizontal line image, and a detected vertical line image are illustrated from left to right

Our computer simulation of the line detection is shown in Fig. 40. Observe that the horizontal and vertical lines are detected.

8.8 Selected Objects Extraction

Selected objects extraction operator extracts an object marked by a binary input image. Define the template of the selected objects extraction as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 1 &{} 0 \\ \hline 1 &{} 4 &{} 1 \\ \hline 0 &{} 1 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 8 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline -8 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(133)
Fig. 41
figure 41

Selected objects extraction memristor DTCNN. Some selected objects marked by a rectangle are extracted. Input images, initial state images, and output images are illustrated from left to right

Our computer simulation of the selected objects extraction is shown in Fig. 41. Observe that some selected objects marked by a rectangle are extracted.

8.9 Filled Contour Extraction

Filled contour extraction operator extracts an object which contains a boundary and which is marked by a binary input image. Furthermore, they are completely filled inside the interior of closed curves. Define the template of the selected objects extraction as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 1 &{} 0 \\ \hline 1 &{} 0 &{} 1 \\ \hline 0 &{} 1 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 2 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline -3 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(134)

Our computer simulation of the filled contour extraction is shown in Fig. 42. Observe that all objects marked by a rectangle are extracted and the interior of all closed curves are filled with black pixels.

Fig. 42
figure 42

Filled contour extraction memristor DTCNN. The regions which contain the boundary and which are marked by rectangles are extracted, while completely filling the interior of all closed curves. Input images, initial state images and output images are illustrated from left to right

8.10 Horizontal Hole and Vertical Hole Detection

Horizontal (resp. vertical) hole detection operator detects horizontal (resp. vertical) holes. Define the template of the horizontal hole detection and vertical hole detection as follows:

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 2 &{} 2 &{} -3 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(135)

and

$$\begin{aligned} \begin{array}{lcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 2 &{} 0 \\ \hline 0 &{} 2 &{} 0 \\ \hline 0 &{} -3 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(136)

Our computer simulation of the horizontal hole and the vertical hole detection is shown in Fig. 43. Observe that the horizontal holes and the vertical holes are detected by these templates.

Fig. 43
figure 43

A horizontal hole and vertical hole detection memristor DTCNN. The number of vertical lines (resp. horizontal lines) in the output images indicates the number of horizontal holes (resp. vertical holes). An initial state and output images for a horizontal hole and vertical hole detection are illustrated from left to right

Fig. 44
figure 44

A memristor DTCNN cell, which consists of a memristor cell C(ij) (yellow), a current pulse generator (salmon pink), a signal generator (medium purple), and voltage-controlled current sources for inputs (light blue), a cell state (light green), cell outputs (pink), and a threshold (chocolate)

9 Advanced Memristor DTCNN

Consider the memristor DTCNN cell shown in Figs. 46 and 44. If we apply a positive current pulse \(I_{p}\) with a height of 1 and a width of 1 into the memristor, we would obtain

$$\begin{aligned} \left. \begin{array}{lll} v_{1}(t) &{}=&{} M_{x}(q) I_{p}(t) = M_{x}(q(t)) \times 1 = M_{x}(q(t)) = x_{ij}(t), \\ v_{2}(t) &{}=&{} M_{y}(q) I_{p}(t) = M_{y}(q(t)) \times 1 = M_{y}(q(t)) = y_{ij}(t), \end{array} \right\} \end{aligned}$$
(137)

A signal generator provides the two signals \(z_{ij}(t)\) and \(p_{ij}(t)\) satisfying the equations

$$\begin{aligned} z_{ij}(t)=y_{ij}(t-T)-y_{ij}(t-2T+1), \end{aligned}$$
(138)

and

$$\begin{aligned} p_{ij}(t)=x_{ij}(t-T)-x_{ij}(t-2T+1), \end{aligned}$$
(139)

respectively. If we assume that the memristance \(M_{x}(q)\) satisfies

$$\begin{aligned} M_{x}(q)= floor(| q |), \end{aligned}$$
(140)

the charge \(q_{ij}(t)\) stored in the memristor during the period \([nT, n T+ \Delta t]\) (\(n=1,2, \ldots \)) is given by

$$\begin{aligned} \begin{array}{lll} q_{ij}( nT + \Delta t ) &{}=&{} \displaystyle c \ x_{ij} \Bigl ( (n-1) T \Bigr ) + \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) \\ &{}&{} \displaystyle \ + \sum _{k, \ l \in (-1, 0, 1)} b_{k, \ l} \ u_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) + w_{ij} + \Delta t , \end{array} \end{aligned}$$
(141)

where \(0< \Delta t < 1\) and

$$\begin{aligned} \left. \begin{array}{lll} x_{ij}( nT ) &{}=&{} M_{x} \Bigl ( q_{ij}( nT ) \Bigr )= floor \Bigl ( | q_{ij}( nT ) | \Bigr ), \\ y_{ij}( nT ) &{}=&{} M_{y} \Bigl ( q_{ij}( nT ) \Bigr ). \end{array} \right\} \end{aligned}$$
(142)

The last term \(\Delta t\) in Eq. (141) indicates the charge stored by a positive current read pulseFootnote 6 (see Fig. 6). The characteristic of the memristance \(M_{y}(q)\) will be given later. For the sake of simplicity, assume that all state variables \(x_{ij}\), \(y_{ij}\) and weighting coefficients \( a_{kl} \), \( b_{kl} \), \( w_{ij}\), and c are non-negative integers. Then, by applying Eqs. (142)–(141), we obtain the equation

$$\begin{aligned} \begin{array}{lll} x_{ij}( nT + \Delta t ) &{}=&{} floor \Bigl ( | q_{ij}( nT + \Delta t ) | \Bigr ) \\ &{}=&{} \displaystyle floor \Biggl ( \biggl | \ c \ x_{ij} \Bigl ( (n-1) T \Bigr ) + \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) \\ &{}&{} \displaystyle + \sum _{k, \ l \in (-1, 0, 1)} b_{k, \ l} \ u_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) + w_{ij} + \Delta t \ \biggr | \Biggr ) \\ &{}=&{} \displaystyle c \ x_{ij} \Bigl ( (n-1) T \Bigr ) + \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) \\ &{}&{} \displaystyle \ + \sum _{k, \ l \in (-1, 0, 1)} b_{k, \ l} \ u_{i+k, \ j+l} \ \Bigl ( (n-1) T \Bigr ) + w_{ij}, \end{array} \end{aligned}$$
(143)

which is equivalent to a DTCNN equation

$$\begin{aligned} \begin{array}{lll} x_{ij}( \tau _{n} ) &{}=&{} \displaystyle c \ x_{ij} ( \tau _{n-1} ) + \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ y_{i+k, \ j+l} \ ( \tau _{n-1} ) \\ &{}&{} \displaystyle \ + \sum _{k, \ l \in (-1, 0, 1)} b_{k, \ l} \ u_{i+k, \ j+l} \ ( \tau _{n-1} ) + w_{ij}, \end{array} \end{aligned}$$
(144)

where \(\tau _{n} {\mathop {=}\limits ^{\triangle }} n T + \Delta t\). If we assume that \(w_{ij}\) is the same for the whole network, the template \(\{ A, B, w, c \}\) is fully specified by 20 parameters, which are the elements of two \(3 \times 3\) matrices A, B, and real numbers w, c, namely,

$$\begin{aligned} A = \begin{array}{|c|c|c|} \hline a_{-1, -1} &{} a_{-1, 0} &{} a_{-1,1} \\ \hline a_{0, -1} &{} a_{0, 0} &{} a_{0,1} \\ \hline a_{1, -1} &{} a_{1, 0} &{} a_{1,1} \\ \hline \end{array} \ , \ \ \ B = \begin{array}{|c|c|c|} \hline b_{-1, -1} &{} b_{-1, 0} &{} b_{-1,1} \\ \hline b_{0, -1} &{} b_{0, 0} &{} b_{0,1} \\ \hline b_{1, -1} &{} b_{1, 0} &{} b_{1,1} \\ \hline \end{array} \ , \ \ \ w = \begin{array}{|c|} \hline w_{0} \\ \hline \end{array} \ , \ \ \ c = \begin{array}{|c|} \hline c_{0} \\ \hline \end{array} \ . \end{aligned}$$
(145)

where \(w_{0}\) and \(c_{0}\) are constants.

9.1 Sandpile Cellular Automaton

The sandpile model is defined on a grid. Each grid point is associated with the height of a sandpile, which is defined below a limiting value. With each time interval, the height at one of the points increases. If a height exceeds the limiting value, the sand must be moved to nearby points until the height at all points are once again below the limiting value. The random placement of sand at a particular point may have no effect, or it may cause a cascading reaction that will affect every point on the grid.Footnote 7

Let us define the rule of sandpile cellular automaton as follows:

  1. 1.

    Each cell has an integer state chosen between 0 and 7 for a von Neumann neighborhood (a diamond-shaped neighborhood).

  2. 2.

    The number of neighbors having states larger than 3 is added to the middle cell.

  3. 3.

    In case the center cell is itself in a state larger than 3, the new state is reduced by 4.

The truth table of the sandpile can be written as follows:

$$\begin{aligned} \begin{array}{c} \text {Rule of Sandpile} \\ \begin{array}{|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{} \\ x_{ij}(\tau _{n-1}) &{} \ 7 \ &{} \ 6 \ &{} \ 5 \ &{} \ 4 \ &{} \ 3 \ &{} \ 2 \ &{} \ 1 \ &{} \ 0 \ \\ &{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{} \\ x_{ij}(\tau _{n}) &{} \xi + 3 &{} \xi + 2 &{} \xi + 1 &{} ~~~w~~~ &{} \xi + 3 &{} \xi + 2 &{} \xi + 1 &{} ~~~ \xi ~~~ \\ &{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(146)

where \(\xi \) denotes the number of neighbors which have states larger than 3.

The above rule can be generated by the difference equation [11]

$$\begin{aligned} x_{i, \ j}(\tau _{n})&= x_{i, \ j}(\tau _{n-1} ) + y_{i-1, \ j}(\tau _{n-1} ) + y_{i, \ j-1}(\tau _{n-1} ) + y_{i, \ j+1}(\tau _{n-1} ) \nonumber \\&\quad + y_{i+1, \ j}(\tau _{n-1} ) - 4 y_{i, \ j}(\tau _{n-1} ), \end{aligned}$$
(147)

where

$$\begin{aligned} \left. \begin{array}{lll} y_{ij} &{}=&{} M_{y}(x_{ij}), \\ M_{y}(q) &{}=&{} \displaystyle \sum _{i=4}^{7} M_{i}(q) = {\left\{ \begin{array}{ll} 0 &{} \text {if } \ q = 1, \ 2, \ 3, \\ 1 &{} \text {if } \ q = 4, \ 5, \ 6, \ 7. \end{array}\right. } \end{array} \right\} \end{aligned}$$
(148)

Thus, the template of the sandpile DTCNN is given by

$$\begin{aligned} \begin{array}{lcllcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 1 &{} 0 \\ \hline 1 &{} -4 &{} 1 \\ \hline 0 &{} 1 &{} 0 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ , &{} c &{} = &{} \begin{array}{|c|} \hline 1 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(149)
Fig. 45
figure 45

Evolution of the sandpile DTCNN for \(t=100\) (left) and \(t=902\) (right) from a random initial pattern. A cascade process sets in (blue points spread on the grid) until all state values are below the threshold (right)

The evolution of the sandpile DTCNN is illustrated in Fig. 45, in which we used the following palette for the state of cells.

$$\begin{aligned} \begin{array}{c} \text{ Color } \text{ palette } \\ \begin{array}{|c|c|c|c|c|c|c|c|c|} \hline \text{ state } &{} 0 &{} 1 &{} 2 &{} 3 &{} 4 &{} 5 &{} 6 &{} 7 \\ \hline \text{ color } &{} \text {white} &{} \text {orange} &{} \text {yellow} &{} \text {red} &{} \text {blue} &{} \text {blue} &{} \text {blue} &{} \text {blue} \\ \hline \end{array} \end{array} \end{aligned}$$
(150)

9.2 Game of Life

Game of Life is a two-dimensional cellular automaton. Each cell has one of two possible states, live (cell value 1) or dead (cell value 0). Each cell interacts with eight neighbors. The Game of Life proceeds according to the rule [6]:

  1. 1.

    Survivals

    Any live cell with two or three live neighbors survives in the next generation.

  2. 2.

    Deaths

    Any live cell with four or more live neighbors dies (is removed) from overpopulation. Every cell with one neighbor or none dies from isolation.

  3. 3.

    Births

    Any dead cell with exactly three live neighbors comes to life.

The truth table defining the Game of Life is as follows:

$$\begin{aligned} \begin{array}{c} \text {Game of Life} \\ \begin{array}{|c|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {sum of live neighbors} &{} \ 8 \ &{} \ 7 \ &{} \ 6 \ &{} \ 5 \ &{} \ 4 \ &{} \ 3 \ &{} \ 2 \ &{} \ 1 \ &{} \ 0 \ \\ &{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ x_{ij}(t+1) &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 1 &{} * &{} 0 &{} 0 \\ &{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(151)

The symbol \(*\) means no change in the next generation. The rules of the Game of Life can be generated from the difference equation [11]

$$\begin{aligned} x_{ij}(t+1) = M_{3}(\xi )+ M_{2}(\xi ) x_{ij}(t), \end{aligned}$$
(152)

where

$$\begin{aligned} \xi {\mathop {=}\limits ^{\triangle }} \left( \sum _{k=-1}^{1} \sum _{m=-1}^{1} x_{i+k, \ j+m}(t) \right) - x_{ij}(t). \end{aligned}$$
(153)

Consider next the memristor cell in Fig. 48. Define the memristance

$$\begin{aligned} \left. \begin{array}{lll} M_{a} &{}=&{} M_{x}(q) = floor(| q |), \\ M_{b} &{}=&{} M_{2}(q), \\ M_{c} &{}=&{} M_{3}(q). \end{array} \right\} \end{aligned}$$
(154)

If we apply a positive current pulse \(I_{p}\) with a height of 1 and a width of 1 into the memristor, we would obtain

$$\begin{aligned} \left. \begin{array}{lll} v_{1} &{}=&{} M_{a}(q) I_{p} = M_{x}(q) = x_{ij}, \\ v_{2} &{}=&{} M_{b}(q) I_{p} = M_{2}(q) = y_{ij}, \\ v_{3} &{}=&{} M_{c}(q) I_{p} = M_{3}(q) = r_{ij}, \end{array} \right\} \end{aligned}$$
(155)

where \(v_{1}, \ v_{2}, \ v_{3}, \ M_{a}(q), \ M_{b}(q)\), and \(M_{c}(q)\) are illustrated in Fig. 48.

Fig. 46
figure 46

A memristor cell C(ij), which consists of two memristors and a switch (top). It has two outputs \(x_{ij}\) and \(y_{ij}+x_{ij}\). A current pulse generator provides a current pulse wave (\(I_{p}\)) to memristors and switches. Switches are turned on when (and only when) a positive current pulse is applied to the cell

Thus, Eq. (152) can be realized by replacing the memristor cell in Fig. 46 with the one in Fig. 48, and providing the following signal from the signal generator

$$\begin{aligned} \begin{array}{lll} z_{ij}(t) &{}=&{} M_{3} \Bigl ( q (t-T) \Bigr ) + M_{2} \Bigl ( q (t-T) \Bigr ) x_{ij}(t-T) \\ &{}&{} - M_{3} \Bigl ( q (t-2T+1) \Bigr ) - M_{2} \Bigl ( q (t-2T+1) \Bigr ) x_{ij}(t-2T+1) \\ &{}=&{} r_{ij}(t-T) + y_{ij}(t-T) x_{ij}(t-T) \\ &{}&{} - r_{ij}(t-2T+1) - y_{ij}(t-2T+1) x_{ij}(t-2T+1). \end{array} \end{aligned}$$
(156)

In this case, the template of the Game of Life DTCNN is given by

$$\begin{aligned} \begin{array}{lcllcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 0 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ , &{} c &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(157)
Fig. 47
figure 47

Evolution of the Game of Life for 50 steps (left) and 100 steps (right) from a random initial pattern

Our computer simulation of a Game of Life is shown in Fig. 47.

9.3 Multitasking Capability

The basic erosion operator erodes away the boundaries of black pixels in binary images. The truth table can be written as follows [11]:

$$\begin{aligned} \begin{array}{c} \text {Rule of Totalistic Erosion} \\ \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \displaystyle \sum _{k=-1}^{1} \sum _{m=-1}^{1} x_{i+k, \ j+m}(\tau _{n-1}) &{} \ 9 \ &{} \ 8 \ &{} \ 7 \ &{} \ 6 \ &{} \ 5 \ &{} \ 4 \ &{} \ 3 \ &{} \ 2 \ &{} \ 1 \ &{} \ 0 \ \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ x_{ij}(\tau _{n}) &{} 1 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(158)

where “1” and “0” in the rule table denote “black” and “white”, respectively. The above rule can be generated from the difference equation

$$\begin{aligned} x_{ij}( \tau _{n} ) = M_{9} \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ x_{i+k, \ j+l} \ ( \tau _{n-1} ) \right) . \end{aligned}$$
(159)

The basic dilation operation enlarges the areas of black pixels at their borders in binary images. The truth table can be written as follows [11]:

$$\begin{aligned} \begin{array}{c} \text {Rule of Totalistic Dilation} \\ \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \displaystyle \sum _{k=-1}^{1} \sum _{m=-1}^{1} x_{i+k, \ j+m}(\tau _{n-1}) &{} \ 9 \ &{} \ 8 \ &{} \ 7 \ &{} \ 6 \ &{} \ 5 \ &{} \ 4 \ &{} \ 3 \ &{} \ 2 \ &{} \ 1 \ &{} \ 0 \ \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ x_{ij}(\tau _{n}) &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 1 &{} 0 \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(160)

where “1” and “0” in the rule table denote “black” and “white”, respectively. The above rule can be generated from the difference equation

$$\begin{aligned} x_{ij}( \tau _{n} ) = 1-M_{0} \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ x_{i+k, \ j+l} \ ( \tau _{n-1} ) \right) . \end{aligned}$$
(161)

The truth table defining the edge detection was written as follows:

$$\begin{aligned} \begin{array}{c} \text {Rule of Edge Detection} \\ \begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \displaystyle \sum _{k=-1}^{1} \sum _{m=-1}^{1} x_{i+k, \ j+m}(\tau _{n-1}) &{} \ 9 \ &{} \ 8 \ &{} \ 7 \ &{} \ 6 \ &{} \ 5 \ &{} \ 4 \ &{} \ 3 \ &{} \ 2 \ &{} \ 1 \ &{} \ 0 \ \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \text {new state of center cell:} \ \ x_{ij}(\tau _{n}) &{} 0 &{} 1 &{} 1 &{} 1 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ &{}&{}&{}&{}&{}&{}&{}&{}&{}&{} \\ \hline \end{array} \end{array} \end{aligned}$$
(162)

Here, we assumed that there are a few white cells in the neighborhood of edge. The above rule can be generated from the difference equation

$$\begin{aligned} x_{ij}( \tau _{n} ) = \sum _{i=6}^{8} M_{i} \left( \sum _{k, \ l \in (-1, 0, 1)} a_{k, \ l} \ x_{i+k, \ j+l} \ ( \tau _{n-1} ) \right) . \end{aligned}$$
(163)
Fig. 48
figure 48

A memristor cell C(ij), which consists of three memristors and a switch (top). It has three outputs \(x_{ij}\), \(y_{ij}+x_{ij}\), and \(r_{ij}+y_{ij}+x_{ij}\). A current pulse generator provides a current pulse wave (\(I_{p}\)) to memristors and switches. Switches are turned on when (and only when) a positive current pulse is applied to the cell

Consider again the memristor cell in Fig. 48. Define the memristance

$$\begin{aligned} \left. \begin{array}{lll} M_{a} &{}=&{} M_{9}(q), \\ M_{b} &{}=&{} 1 - M_{0}(q), \\ M_{c} &{}=&{} M_{6}(q) + M_{7}(q) + M_{8}(q), \end{array} \right\} \end{aligned}$$
(164)

which correspond to erosion, dilation and edge detection operations. Then, the DTCNN can perform an erosion operation, a dilation operation and an edge detection operation simultaneously with one operation. Furthermore, if we connect the memristor with the memristance

$$\begin{aligned} M(q) = floor \Bigl ( \ 28 \ |q| \ \Bigr ), \end{aligned}$$
(165)

in series, it can also perform a half-toning operation simultaneously.

In this case, the template of the multitasking DTCNN is given by

$$\begin{aligned} \begin{array}{lcllcllcllcl} A &{} = &{} \begin{array}{|c|c|c|} \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline 1 &{} 1 &{} 1 \\ \hline \end{array} \ , &{} B &{} = &{} \begin{array}{|c|c|c|} \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline 0 &{} 0 &{} 0 \\ \hline \end{array} \ , &{} w &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ , &{} c &{} = &{} \begin{array}{|c|} \hline 0 \\ \hline \end{array} \ . \end{array} \end{aligned}$$
(166)
Fig. 49
figure 49

Multitasking capability of a memristor cellular automaton. Binary images can be transformed into erosion images, dilation images, edge detection images, and half-toning images (illustrated from top to bottom) simultaneously with one operation

Our computer simulation of a multitasking operation is shown in Fig. 49.

10 Conclusion

In this paper, we have proposed the memristor cellular automaton and the memristor discrete-time cellular neural network, which can perform some logical operations, image processing operations and complex behaviors. There are many possible generalizations of these systems, which will be presented elsewhere.