Cody

# Problem 2130. Orthonormal matrix

Solution 685326

Submitted on 10 Jun 2015 by vaibhav hosur
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% a=[1 0 0 ;0 1 0;0 0 1] tf = 1; assert(isequal(ortho_normal(a),tf))

a = 1 0 0 0 1 0 0 0 1 i = 3 j = 3 I = 1 0 0 0 1 0 0 0 1

2   Pass
%% a=[0 0 1 0;0 1 0 0;1 0 0 0;0 0 0 1] tf = 1; assert(isequal(ortho_normal(a),tf))

a = 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 i = 4 j = 4 I = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

3   Pass
%% a=eye(20) k=a; p=a; a(:,1)=k(:,end); a(:,end)=k(:,1); a(:,5)=p(:,9); a(:,9)=p(:,5) tf = 1; assert(isequal(ortho_normal(a),tf))

a = Columns 1 through 16 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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0 0 1 0 0 0 0 1

5   Pass
%% a=[0 0 2 0;0 1 0 0;1 0 -1 0;0 0 0 1] tf = 0; assert(isequal(ortho_normal(a),tf))

a = 0 0 2 0 0 1 0 0 1 0 -1 0 0 0 0 1 i = 4 j = 4 I = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

6   Pass
%% a=[1 2 3 ;1 1 5;3 0 1] tf = 0; assert(isequal(ortho_normal(a),tf))

a = 1 2 3 1 1 5 3 0 1 i = 3 j = 3 I = 1 0 0 0 1 0 0 0 1

7   Pass
%% a =[1 0 0 ;0 0 0; 0 0 0] tf = 0; assert(isequal(ortho_normal(a),tf))

a = 1 0 0 0 0 0 0 0 0 i = 3 j = 3 I = 1 0 0 0 1 0 0 0 1