mirror of
https://github.com/jlengrand/LAFF.git
synced 2026-03-10 15:51:12 +00:00
95 lines
1.9 KiB
Matlab
Executable File
95 lines
1.9 KiB
Matlab
Executable File
% Create some vectors
|
|
x = [
|
|
1
|
|
2
|
|
3
|
|
]
|
|
y = [
|
|
0
|
|
-1
|
|
-2
|
|
]
|
|
z = [
|
|
4
|
|
3
|
|
2
|
|
1
|
|
]
|
|
|
|
% test dot product of column vector with column vector
|
|
disp( 'dot product of column vector with column vector' )
|
|
if ( isequal( laff_dot( x, y ), x' * y ) )
|
|
disp( 'TEST PASSED' )
|
|
else
|
|
disp( 'TEST FAILED' )
|
|
end
|
|
|
|
disp( ' ' )
|
|
|
|
% test dot product of column vector with row vector
|
|
disp( 'dot product of column vector with row vector' )
|
|
if ( isequal( laff_dot( x, y' ), x' * y ) )
|
|
disp( 'TEST PASSED' )
|
|
else
|
|
disp( 'TEST FAILED' )
|
|
end
|
|
|
|
disp( ' ' )
|
|
|
|
% test dot product of row vector with column vector
|
|
disp( 'dot product of row vector with column vector' )
|
|
if ( isequal( laff_dot( x', y ), x' * y ) )
|
|
disp( 'TEST PASSED' )
|
|
else
|
|
disp( 'TEST FAILED' )
|
|
end
|
|
|
|
disp( ' ' )
|
|
|
|
% test dot product of row vector with row vector
|
|
disp( 'dot product of row vector with row vector' )
|
|
if ( isequal( laff_dot( x', y' ), x' * y ) )
|
|
disp( 'TEST PASSED' )
|
|
else
|
|
disp( 'TEST FAILED' )
|
|
end
|
|
|
|
disp( ' ' )
|
|
|
|
% test dot product of column vector with column vector (wrong size)
|
|
disp( 'dot product of column vector with column vector (wrong size)' )
|
|
if ( isequal( laff_dot( x, z ), 'FAILED' ) )
|
|
disp( 'TEST PASSED' )
|
|
else
|
|
disp( 'TEST FAILED' )
|
|
end
|
|
|
|
disp( ' ' )
|
|
|
|
% test dot product of column vector with row vector (wrong size)
|
|
disp( 'dot product of column vector with row vector (wrong size)' )
|
|
if ( isequal( laff_dot( x, z' ), 'FAILED' ) )
|
|
disp( 'TEST PASSED' )
|
|
else
|
|
disp( 'TEST FAILED' )
|
|
end
|
|
|
|
disp( ' ' )
|
|
|
|
% test dot product of row vector with column vector (wrong size)
|
|
disp( 'dot product of row vector with column vector (wrong size)' )
|
|
if ( isequal( laff_dot( x', z ), 'FAILED' ) )
|
|
disp( 'TEST PASSED' )
|
|
else
|
|
disp( 'TEST FAILED' )
|
|
end
|
|
|
|
disp( ' ' )
|
|
|
|
% test dot product of row vector with row vector (wrong size)
|
|
disp( 'dot product of row vector with row vector (wrong size)' )
|
|
if ( isequal( laff_dot( x', z' ), 'FAILED' ) )
|
|
disp( 'TEST PASSED' )
|
|
else
|
|
disp( 'TEST FAILED' )
|
|
end |