Skip to content

Commit

Permalink
changed Uint32Arrays into Int32Array
Browse files Browse the repository at this point in the history
we expect to receive negative values for colIndexes and rowIndexes, therefore we need a data structure that allows negative values
  • Loading branch information
Razvan1928 committed Mar 26, 2024
1 parent c46b8b7 commit 4ab7063
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type { Dimensions, Transform, WaferMapMatrix, WaferMapTypedMatrix } from
* This setup is used in the wafer-map component to perform heavy computational duties
*/
export class MatrixRenderer {
public colIndexes: Uint32Array = Uint32Array.from([]);
public rowIndexes: Uint32Array = Uint32Array.from([]);
public colIndexes: Int32Array = Int32Array.from([]);
public rowIndexes: Int32Array = Int32Array.from([]);
public values = new Float64Array([]);
public scaledColIndex = new Float64Array([]);
public scaledRowIndex = new Float64Array([]);
Expand Down Expand Up @@ -72,8 +72,8 @@ export class MatrixRenderer {
}

public emptyMatrix(): void {
this.colIndexes = Uint32Array.from([]);
this.rowIndexes = Uint32Array.from([]);
this.colIndexes = Int32Array.from([]);
this.rowIndexes = Int32Array.from([]);
this.values = Float64Array.from([]);
}

Expand All @@ -91,8 +91,8 @@ export class MatrixRenderer {
public updateMatrix(
data: WaferMapMatrix
): void {
this.colIndexes = Uint32Array.from(data.colIndexes);
this.rowIndexes = Uint32Array.from(data.rowIndexes);
this.colIndexes = Int32Array.from(data.colIndexes);
this.rowIndexes = Int32Array.from(data.rowIndexes);
this.values = Float64Array.from(data.values);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ describe('MatrixRenderer with MessageChannel', () => {
const updatedMatrix = await matrixRenderer.getMatrix();
expect(updatedMatrix).toEqual(
{
colIndexes: Uint32Array.from(testData.colIndexes),
rowIndexes: Uint32Array.from(testData.rowIndexes),
colIndexes: Int32Array.from(testData.colIndexes),
rowIndexes: Int32Array.from(testData.rowIndexes),
values: Float64Array.from(testData.values)
}
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface WaferMapTypedMatrix {
colIndexes: Uint32Array;
rowIndexes: Uint32Array;
colIndexes: Int32Array;
rowIndexes: Int32Array;
values: Float64Array;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ describe('MatrixRenderer worker', () => {
const resolvedDieMatrix = await matrixRenderer.getMatrix();

expect(resolvedDieMatrix.colIndexes).toEqual(
Uint32Array.from(testData.colIndexes)
Int32Array.from(testData.colIndexes)
);
expect(resolvedDieMatrix.rowIndexes).toEqual(
Uint32Array.from(testData.rowIndexes)
Int32Array.from(testData.rowIndexes)
);
expect(resolvedDieMatrix.values).toEqual(
Float64Array.from(testData.values)
Expand Down

0 comments on commit 4ab7063

Please sign in to comment.