# /Users/garethloy/Musimathics/Musimat1.2/MusimatChapter9/C091102.cpp File Reference

`#include "MusimatChapter9.h"`

Go to the source code of this file.

## Functions

MusimatChapter9Section (C091102)
IntegerMatrix setComplex (IntegerList prime)
Static Void para1 ()
IntegerList getPC (PitchList p)
Void generateSetComplex (PitchList P)
Static Void para2 ()

## Function Documentation

 Void generateSetComplex ( PitchList P )

Definition at line 101 of file C091102.cpp.

References getPC(), setComplex(), and transpose().

```                                     {
IntegerList set = getPC(P);
Print("Starting set:", set);
Integer offset = set;
IntegerList tSet = transpose(set, -offset);
Print("Transposed set:", tSet);
IntegerMatrix sc = setComplex( tSet );
Print("Set complex:");
Print(sc);
}
```
 IntegerList getPC ( PitchList p )

Definition at line 91 of file C091102.cpp.

```                               {
IntegerList x;

For (Integer i = 0; i < Length(p); i++)
x[i] = PitchClass(p[i]) + Accidental( p[i] );

Return( x );
}
```
 MusimatChapter9Section ( C091102 )

Definition at line 2 of file C091102.cpp.

References para1(), and para2().

```                                {
Print("*** 9.11.2 The Set Complex ***");
/*****************************************************************************

9.11.2 The Set Complex

Using these tools, we can create a matrix containing the prime form, inverse,
retrograde, and all transpositions of any row, called the set complex. The
purpose of these transformations is to generate variants that are related to
the original intervallic structure of the prime row, to be used as material
in developing compositions.

Matrix is simply a two-dimensional grid, or list of lists, all of the same
length. The individual elements of Matrix can be accessed by extending the
index operator [�]. The first operand is the matrix, the second is the row
position, and the third is the column position. (Whether row or column comes
first is arbitrary. The following order is called row/column order.)

0       1
M =    0       A       B
1       C       D

For example, for this matrix, M == A, M == B, M == C, and
M == D. The following is a method for creating a set complex. It
basically copies the prime form to the zeroth row, then copies the inverse
form to the zeroth column, then for each other cell in the matrix sums the
corresponding row and column value modulo the length of the prime form:
*****************************************************************************/
para1(); // Step into this function to continue.
para2(); // Step into this function to continue.
}
```
 Static Void para1 ( )

Definition at line 56 of file C091102.cpp.

```                    {
/*****************************************************************************
To demonstrate these tools, table 9.4 shows the set complex the following row:
(G, As, B, F, E, Cs, C, A, Gs, D, Ds, Fs)
o  Prime rows are read left to right,
o  Retrograde rows, right to left
o  Inverse rows, top to bottom,
o  Retrograde inverse rows, bottom to top.
This completes the precomposition phase. Now it's time to look at methods to
traverse the rows created with the preceding techniques to generate a
composition.

Table 9.4 Set Complex
{0, 3, 4, 10, 9, 6, 5, 2, 1, 7, 8, 11}
{9, 0, 1, 7, 6, 3, 2, 11, 10, 4, 5, 8}
{8, 11, 0, 6, 5, 2, 1, 10, 9, 3, 4, 7}
{2, 5, 6, 0, 11, 8, 7, 4, 3, 9, 10, 1}
{3, 6, 7, 1, 0, 9, 8, 5, 4, 10, 11, 2}
{6, 9, 10, 4, 3, 0, 11, 8, 7, 1, 2, 5}
{7, 10, 11, 5, 4, 1, 0, 9, 8, 2, 3, 6}
{10, 1, 2, 8, 7, 4, 3, 0, 11, 5, 6, 9}
{11, 2, 3, 9, 8, 5, 4, 1, 0, 6, 7, 10}
{5, 8, 9, 3, 2, 11, 10, 7, 6, 0, 1, 4}
{4, 7, 8, 2, 1, 10, 9, 6, 5, 11, 0, 3}
{1, 4, 5, 11, 10, 7, 6, 3, 2, 8, 9, 0}

The functions below perform steps in preparation for calling setComplex().
getPC() converts a PitchList to an IntegerList by summing the diatonic
pitch class and accidental of the Pitch.
generateSetComplex() first calls getPC() to convert the Pitch list to
an IntegerList, then transposes the resulting set, then
invokes setComplex() to generate the set complex Matrix.
*****************************************************************************/
}
```
 Static Void para2 ( )

Definition at line 112 of file C091102.cpp.

References generateSetComplex().

```                    {
/*****************************************************************************
Here we evaluate the set complex for our test set.
*****************************************************************************/
PitchList test(G, As, B, F, E, Cs, C, A, Gs, D, Ds, Fs);
Print("*** Pitch classes for test ***");
Print(test);
generateSetComplex(test);

}
```
 IntegerMatrix setComplex ( IntegerList prime )

Definition at line 34 of file C091102.cpp.

References a(), b(), and invert().

```                                            {
Print("Prime row:", prime);
Integer len = Length(prime);
IntegerMatrix M(len, len);
IntegerList inverted = invert(prime);
Print("Inverted row:", inverted);
For (Integer i = 0; i < len; i = i + 1) {
M[i] = prime[i];
M[i] = inverted[i];
}
For (Integer i = 1; i < len; i = i + 1) {
For (Integer j = 1; j < len; j = j + 1) {
Integer a = M[i];
Integer b = M[j];
// M(i,j) = Mod(M(i,0) + M(0,j), len);
M[i][j] = Mod(a + b, len);
}
}
Return(M);
}
```