{'fraction_non_alphanumeric': 0.027873841471849493, 'fraction_numerical': 0.006017429796652372, 'mean_word_length': 5.572272727272727, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Multiset Signal Processing and Electronics

Multisets are an intuitive extension of the traditional concept of sets that allow repetition of elements, with the number of times each element appears being understood as the respective multiplicity. Recent generalizations of multisets to real-valued functions, accounting for possibly negative values, have paved the way to a number of interesting implications and applications, including respective implementations as electronic systems. The basic multiset operations include the set complementation (sign change), intersection (minimum between two values), union (maximum between two values), difference and sum (identical to the algebraic counterparts). When applied to functions or signals, the sign and conjoint sign functions are also required. Given that signals are functions, it becomes possible to effectively translate the multiset and multifunction operations to analog electronics, which is the objective of the present work. It is proposed that effective multiset operations capable of high performance self and cross-correlation can be obtained with relative simplicity in either discrete or integrated circuits. The problem of switching noise is also briefly discussed. The present results have great potential for applications and related developments in analog and digital electronics, as well as for pattern recognition, signal processing, and deep learning.


Introduction
Electronics and signal processing, especially in their linear modalities, have largely relied on the algebraic operations of sum, subtraction, and product of signals. Filtering, self-and cross correlations are just some examples of the interesting applications of linear signal processing (e.g. [1,2,3,4]) and electronics (e.g. [5,6,7]). One problem with classic signal processing applications concerns the fact that the involved real products are not easily implemented, requiring specific high performance digital circuits.
Multisets (e.g. [8,9,10,11,12,13]) corresponds to an interesting and conceptually powerful extension of set theory that allows repeated elements to be taken into account. In a sense, multiset theory seems to be even more compatible with human intuition than the now classic set theory.
While multisets had been mostly applied to categorical or non-negative values, they can be generalized to real values, including possibly negative values [14,15,16]. This can be achieved by allowing the multiset difference operation to lead to negative multiplicities, which implies the universe multiset to be identical to the empty multiset, therefore establishing a stable complement operation.
Real-value multisets have been further generalized to real function spaces [15], allowing the integration of multiset concepts and properties with the whole set of algebraic operations, so that hybrid expressions such as: can be obtained [15,16]. When applied to real function spaces, multisets have been called multifunctions, while their image values are associated with the real-valued multisets multiplicities.
These generalizations paved the way to a wide range of possible developments and applications in the most diverse areas. For instance, it has been shown that the common product between two functions provides substantially enhanced potential for performing filtering and pattern recognition operations, including template matching [15,17].
More specifically, sharper and narrower matching peaks are typically obtained at the same time as secondary matches and noise are effectively eliminated. These desirable features stem from the fact that, though involving the extremely simple operations as the minimum and maxi-mum binary operations (in the sense of taking two arguments), the common product, as well as several multifunction operations, are ultimately non-linear. Results derived from these developments have also been found to allow impressive performance for clustering (non-supervised pattern recognition) [18] and Complex network representations and community finding [19].
The present work addresses the impementation of signal processing methods involving real-valued multisets and multifunctions as electronic circuits. There are several motivations for doing so. First, we have that the effective implementation of operations such as the common product allowed especially accurate and effective real-time applications in several related areas, including pattern recognition, deep learning, an control systems. Particularly promising is the implementation of the suggested electronic operators in integrated electronics. Second, the implementation of the multifunction operations in electronic devices paves the way to their effective incorporation into the area of signal and image processing.
After introducing and illustrating some of the main multiset/multifunction operations, the common product in its elementwise and functional forms, as well as the respectively obtainable correlation methods, are briefly outlined.
Subsequently, we propose respective implementations in relatively simple electronic circuits, involving a combination of a few standard linear and digital devices, including analog switches, operational amplifiers, comparators and equivalence logic operation. A complete implementation of the elementwise common product is then proposed and discussed.

Basic Real-Valued Multiset Operations
Given a signal f (t), its multiset complement is immediately obtained as −f (t).
The sign function of f (t) is henceforth understood to corresponds to: Given an additional signal g(t), the intersection between these signals can be expressed as: Similarly, the union between the two signals can be expressed as: The conjoint sign function between the signals f (t) and g(t) is defined as: (1) Figure 1 illustrates two signals, namely a cosine (a) and sine (b) along a complete respective period, as well as the associated sign (c-d) and conjoint (e) sign functions. Figure 7 are the operations of these realvalued multiset operations with respect to two signals f (t) and g(t) shown in Figure 1.

The Common Product and Correlation
Given two signals f (t) and g(t), their elementwise common product [15,20] can be defined as: This operation is illustrated in Figure 7(g) with respect to a full period of the sine and cosine functions. Observe that the respective result can be understood as the common region of the functions comprised between their extrema and the horizontal axis.
The functional associated to the common, along a support region S, can now be expressed [14,15,20] as: Observe that, though analogous to the classic inner product, this functional is actually non-bilinear, therefore not constituting formally an inner product. It is precisely the non-linear characteristics of this operation that allow its enhanced performance when applied to filtering and pattern recognition. Yet, this operation is characterized by great conceptual and informational simplicity, requiring only a signed addition in computational terms.
Given the common product functional, the respective cross-correlation can be immediately obtained as: This operation has been observed to yield interesting results in filtering and pattern recognition applications [17]. When employed jointly with other multifunction operations, the common product convolution becomes the real-valued Jaccard and coincidence indices [14], which have been verified to allow remarkable performance for tasks such as non-supervised classification and complex networks representation and community enhancement [17,18,19].
As such, it becomes of particular interest to contemplate the implementation of the elementwise common product, which provides the basis for a wide range of applications including those commented above, in electronic hardware, which is addressed in the two following sections.

Electronic Implementation
Interestingly, all the basic real-valued multiset operations presented in Section 2 can be ready and effectively implemented in analog circuitry (e.g. [21,22]) though, as we will see, special attention is required regarding switching noise, as well as ensuring that the relative delays between the involved operations are synchronized as much as possible. All the proposed circuit implementations in the remainder of this work have been mostly conceived from the didactic perspective and as a proof of concept of the possibilities proposed in the current work. Figure 3 illustrates a possible implementation of the sign function by using the electronic device known as comparator, which basically corresponds to an operational amplifier optimized for fast switching. This is a classic basic circuit involving an operational amplifier [23,24,3].
The intersection between signals f (t) and g(t) can be conveniently obtained by using an operational amplifier and an analog switch as illustrated in Figure 4(a), while the signal union can be readily implemented by swapping the operational amplifier inputs as shown in Figure 4(b).
The absolute value of f (t), namely s f f (t), can be easily obtained by employing an analog switch, a comparator, and an inverting amplifier, as illustrated in Figure 5.
The conjoint sign function between the signals f (t) and g(t), illustrated in Figure 6, requires two comparators and an analog equivalence gate.
Another multiset operation that needs to be electronically implemented concerns the here called signification, which consists of multiplying the sign provided by a sign function s f into a respective function f (t). The elementwise common product (Section 3) is shown in (d) together with the original functions f (t) and g(t). Observe that the common product corresponds to the regions of the two functions that are common while taking as reference the horizontal axis. The common product on the signal in (d), which corresponds to integrating this signal along its support, yields zero, indicating null relationship between the cosine and sine function. Observe that this operation can be understood as corresponding to the inverse of the absolute value operation, respectively to the same sign function. Indeed, the absolute operation on any signal f (t) followed by the respective signification will recover the original function f (t).    Observe that, except for eventual electronic artifacts, the conjoint operator followed by the respective significator will have not effect on the input signal f (t), as these two operations are one the inverse of the other.

Elementwise Common Product Implementation
Having proposed preliminary respective electronic implementations for several important multifunction operations, we are now in position to propose a complete design of an elementwise common product operator, which is shown in Figure 8. This suggested design involves only three operational amplifiers, five comparators, for switches and an analog equivalence gate. This implementation is aimed mostly as a proof or concept, being by no means intended to be particularly operational or effective. Indeed, much more efficient designs can be achieved at the level of more basic componentes such as transistors, especially when considering implementations in integrated electronics.
One aspect deserving particular attention regards the need to condition and control the high frequency switching noise implied by the four analog switches. This can be addressed by incorporating respective low-pass filtering and related techniques, though at the probably expense of signal speed. Additional research is required before an operational version of the proposed implementation of the elementwise common product can be obtained.
Another important issue regards the relative delays implied by each of the composing subsystems. In other words, it is important to ensure that these delays are properly matches so as to ensure proper synchronization along the combination of the partial results. This issue, however, is more critical only for particularly high frequency signals.

Concluding Remarks
Electronics and signal processing have intensively relied on algebraic operations such as sums, subtractions and products between functions, the latter being particularly complex and involving relatively large respective circuitry.
The recent generalization of multiset concepts to take into account real-valued functions has paved the way to a wide range of possible new concepts, developments, and applications.
In this work, we addressed the possibility to establish analogous implementations of each of the main multiset/multifunction operations, including the sign and conjoint sign functions, the minimum (intersection) and maximum (union) between pairs of signals, as well as the absolute value and the inverse operation of signification.
These developments allowed us to propose a complete possible implementation of the elementwise common product, which is the basic element in the respective common product and common product correlation between signals, all of which have been shown to have impressive potential for several applications such as in signal processing, pattern recognition, deep learning, and control systems.
Further developments include, but are not limited to, devising more effective and operational implementations of the elementwise common product, as well as circuits Figure 8: An implementation of the elementwise common product employing comparators, operational amplifiers, and analog switches. This circuit is capable of identifying the common area between the two input signals f (t) and g(t) as illustrated in Fig. 7(d). The integration of the elementwise product, which can be obtained by adding just another operational amplifier, provides an effective quantification of the similarity between the two signals. Observe that this operation is intrinsically non-linear as a consequence of the minimum operator. More effective designs can be obtained by taking advantage of redundant portions of this configuration. Particularly effective integrated electronics implementations can be obtained. A point deserving special attention regards the switching noise implied by the analog switches as well as the synchronization of the delays involved by the incorporated modules.
capable of performing the common product and respective correlation. Also of interest are respective implementations in the context of digital signal processing (e.g. [25,1,2]), as well as shape and image analysis [26].