Initialize identity for sigma < 256

Change-Id: I18305fc2d9f852b4567e25771c01ad190322e224
diff --git a/datok.go b/datok.go
index 0ffaac0..6fe4f3c 100644
--- a/datok.go
+++ b/datok.go
@@ -93,6 +93,13 @@
 
 	dat.resize(dat.final)
 
+	// Init with identity
+	if dat.identity != -1 {
+		for i := 0; i < 256; i++ {
+			dat.sigmaASCII[i] = dat.identity
+		}
+	}
+
 	for num, sym := range auto.sigmaRev {
 		if int(sym) < 256 {
 			dat.sigmaASCII[int(sym)] = num
@@ -661,6 +668,13 @@
 	// Shouldn't be relevant though
 	dat.maxSize = arraySize - 1
 
+	// Init with identity
+	if dat.identity != -1 {
+		for i := 0; i < 256; i++ {
+			dat.sigmaASCII[i] = dat.identity
+		}
+	}
+
 	for x := 0; x < sigmaCount; x++ {
 		sym, _, err := r.ReadRune()
 		if err == nil && sym != 0 {
@@ -841,12 +855,6 @@
 					eot = true
 				}
 				a = dat.sigmaASCII[int(char)]
-
-				// Use identity symbol if character is not in sigma
-				if a == 0 && dat.identity != -1 {
-					a = dat.identity
-				}
-
 			} else {
 				a, ok = dat.sigma[char]
 
diff --git a/datok_test.go b/datok_test.go
index d3de001..2435acf 100644
--- a/datok_test.go
+++ b/datok_test.go
@@ -1087,3 +1087,8 @@
 //   BenchmarkDoubleArrayConstruction-4         79394             14561 ns/op           10703 B/op         29 allocs/op
 //   BenchmarkDoubleArrayLarger-4                  19          60257675 ns/op         6357911 B/op       2577 allocs/op
 //   BenchmarkMatrixTransduce-4                 35076             30581 ns/op           28944 B/op         17 allocs/op
+// 2021-12-05 - init identity for sigma < 256
+//   BenchmarkDoubleArrayTransduce-4            35284             31918 ns/op           28944 B/op         17 allocs/op
+//   BenchmarkDoubleArrayConstruction-4         80342             14504 ns/op           10703 B/op         29 allocs/op
+//   BenchmarkDoubleArrayLarger-4                  19          60343253 ns/op         6357789 B/op       2575 allocs/op
+//   BenchmarkMatrixTransduce-4                 34029             30238 ns/op           28944 B/op         17 allocs/op
diff --git a/matrix.go b/matrix.go
index 565de87..567430b 100644
--- a/matrix.go
+++ b/matrix.go
@@ -37,11 +37,16 @@
 		stateCount: auto.stateCount,
 	}
 
-	for i := 0; i < 256; i++ {
-		mat.sigmaASCII[i] = mat.identity
+	max := 0
+
+	// Init with identity
+	if mat.identity != -1 {
+		for i := 0; i < 256; i++ {
+			mat.sigmaASCII[i] = mat.identity
+		}
+		max = mat.identity
 	}
 
-	max := 0
 	for num, sym := range auto.sigmaRev {
 		if int(sym) < 256 {
 			mat.sigmaASCII[int(sym)] = num
@@ -272,6 +277,13 @@
 	sigmaCount := int(bo.Uint16(buf[12:14]))
 	arraySize := (mat.stateCount + 1) * sigmaCount
 
+	// Init with identity
+	if mat.identity != -1 {
+		for i := 0; i < 256; i++ {
+			mat.sigmaASCII[i] = mat.identity
+		}
+	}
+
 	for x := 0; x < sigmaCount; x++ {
 		sym, _, err := r.ReadRune()
 		if err == nil && sym != 0 {
@@ -403,11 +415,6 @@
 					eot = true
 				}
 				a = mat.sigmaASCII[int(char)]
-
-				if a == 0 && mat.identity != -1 {
-					a = mat.identity
-				}
-
 			} else {
 				a, ok = mat.sigma[char]