Skip to content

Commit

Permalink
fix(test) thisSplitter unitary for (a)diag orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
stared committed Dec 13, 2015
1 parent b640ae8 commit 127deca
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions js/tensor/full.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,15 @@ describe('thinSplitter', () => {
expect(full.thinSplitter.length).toBe(4);
});

it('should consist of unitary tensors', () => {
_.each(full.thinSplitter, (tensor) => {
it('diagonal orientations should consist of unitary tensors', () => {
_.each(_.at(full.thinSplitter, [1, 3]), (tensor) => {
for (let entry of tensor.map.values()) {
const probabilities = _.sum(_.map([...entry.values()], probability));
expect(probabilities).toBeCloseTo(1, 5);
}
});
});

it('should pass a beam parallel to the element', () => {
// 0th element represents splitter's "-" rotation,
// so it's parallel to ">" beam direction.
const transition = full.thinSplitter[0].map.get('>-');

expect(transition.size).toBe(1);
expect(transition.get('>-')).toBeDefined();
});

it('should pass half of the beam perpendicular to the element', () => {
// 2nd element represents splitter's "|" rotation,
// so it's perpendicular to ">" beam direction.
Expand Down

0 comments on commit 127deca

Please sign in to comment.