Skip to content

Commit 70426d4

Browse files
committed
Prevent clang-format from messing with Matlab files.
1 parent 35bc5cb commit 70426d4

File tree

5 files changed

+27
-26
lines changed

5 files changed

+27
-26
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ repos:
88
rev: v16.0.6
99
hooks:
1010
- id: clang-format
11+
exclude: '\.m$'
1112

1213
- repo: https://github.com/pre-commit/pre-commit-hooks
1314
rev: v4.4.0

bindings/matlab/bsp_matrix_create.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
%
1616
% Fields:
1717
% values - MATLAB array of matrix values
18-
% indices_0 - MATLAB array of first dimension indices
18+
% indices_0 - MATLAB array of first dimension indices
1919
% indices_1 - MATLAB array of second dimension indices
2020
% pointers_to_1 - MATLAB array of pointers for compressed formats
2121
% nrows - Number of rows (integer)
22-
% ncols - Number of columns (integer)
22+
% ncols - Number of columns (integer)
2323
% nnz - Number of non-zeros (integer)
2424
% is_iso - Logical indicating if matrix has single value (logical)
2525
% format - Matrix format string ('CSR', 'CSC', 'COO', etc.)
@@ -28,10 +28,10 @@
2828
% Example:
2929
% % Create empty matrix
3030
% matrix = bsp_matrix_create();
31-
%
31+
%
3232
% % Create COO matrix
3333
% values = [1.0, 2.0, 3.0];
34-
% rows = [1, 2, 3];
34+
% rows = [1, 2, 3];
3535
% cols = [1, 2, 3];
3636
% matrix = bsp_matrix_create(values, rows, cols, [], 3, 3, 3, false, 'COO', 'general');
3737

@@ -48,7 +48,7 @@
4848
'is_iso', false, ...
4949
'format', '', ...
5050
'structure', 'general');
51-
51+
5252
elseif nargin == 10
5353
% Create matrix with all fields specified
5454
matrix = struct(...
@@ -62,10 +62,10 @@
6262
'is_iso', logical(varargin{8}), ...
6363
'format', char(varargin{9}), ...
6464
'structure', char(varargin{10}));
65-
65+
6666
else
6767
error('bsp_matrix_create:InvalidArgs', ...
6868
'Expected 0 or 10 arguments, got %d', nargin);
6969
end
7070

71-
end
71+
end

bindings/matlab/bsp_matrix_info.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ function bsp_matrix_info(matrix)
4848
length(matrix.pointers_to_1), class(matrix.pointers_to_1));
4949
end
5050

51-
end
51+
end

bindings/matlab/test_bsp_hello_octave.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function test_bsp_hello_octave()
3131
result1 = bsp_hello();
3232
fprintf(' Result: %s\n', result1);
3333
fprintf(' Status: PASS\n\n');
34-
34+
3535
% Test 2: Version query
3636
fprintf('Test 2: Version query - bsp_hello(''version'')\n');
3737
[version, success] = bsp_hello('version');
@@ -42,7 +42,7 @@ function test_bsp_hello_octave()
4242
else
4343
fprintf(' Status: FAIL - Function reported error\n\n');
4444
end
45-
45+
4646
% Test 3: Error handling - invalid mode
4747
fprintf('Test 3: Error handling - bsp_hello(''invalid'')\n');
4848
try
@@ -53,7 +53,7 @@ function test_bsp_hello_octave()
5353
fprintf(' Caught expected error: %s\n', lasterr_msg);
5454
fprintf(' Status: PASS\n\n');
5555
end
56-
56+
5757
% Test 4: Type checking - numeric input
5858
fprintf('Test 4: Type checking - bsp_hello(42)\n');
5959
try
@@ -64,17 +64,17 @@ function test_bsp_hello_octave()
6464
fprintf(' Caught expected error: %s\n', lasterr_msg);
6565
fprintf(' Status: PASS\n\n');
6666
end
67-
67+
6868
fprintf('=== All Tests Completed ===\n');
6969
fprintf('The Binsparse Octave bindings appear to be working correctly!\n\n');
70-
70+
7171
% Display system information
7272
fprintf('System Information:\n');
7373
if exist('OCTAVE_VERSION', 'builtin')
7474
fprintf(' Octave Version: %s\n', OCTAVE_VERSION);
7575
end
7676
fprintf(' Platform: %s\n', computer());
77-
77+
7878
% Check for mkoctfile
7979
[status, output] = system('mkoctfile --version 2>/dev/null || mkoctfile --version 2>nul');
8080
if status == 0
@@ -84,15 +84,15 @@ function test_bsp_hello_octave()
8484
fprintf(' mkoctfile: %s\n', strtrim(lines{1}));
8585
end
8686
end
87-
87+
8888
catch
8989
lasterr_msg = lasterr();
9090
fprintf('=== TEST FAILED ===\n');
9191
fprintf('Error: %s\n', lasterr_msg);
92-
92+
9393
% In Octave, we don't have ME.stack, so provide simpler error info
9494
fprintf('Last error occurred in test_bsp_hello_octave\n');
9595
rethrow(lasterr());
9696
end
9797

98-
end
98+
end

bindings/matlab/test_bsp_matrix_struct.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,43 @@ function test_bsp_matrix_struct()
1717
fprintf('Empty matrix created successfully\n');
1818
bsp_matrix_info(empty_matrix);
1919
fprintf('\n');
20-
20+
2121
% Test 2: Create simple COO matrix
2222
fprintf('Test 2: Creating simple COO matrix\n');
2323
% 3x3 identity matrix in COO format
2424
values = [1.0, 1.0, 1.0];
2525
rows = uint64([0, 1, 2]); % 0-based indexing like C
2626
cols = uint64([0, 1, 2]); % 0-based indexing like C
2727
pointers = uint64([]); % Empty for COO format
28-
28+
2929
coo_matrix = bsp_matrix_create(values, rows, cols, pointers, ...
3030
3, 3, 3, false, 'COO', 'general');
3131
fprintf('COO matrix created successfully\n');
3232
bsp_matrix_info(coo_matrix);
3333
fprintf('\n');
34-
34+
3535
% Test 3: Create CSR matrix
3636
fprintf('Test 3: Creating simple CSR matrix\n');
3737
% Same 3x3 identity in CSR format
3838
csr_values = [1.0, 1.0, 1.0];
3939
csr_cols = uint64([0, 1, 2]);
4040
csr_rows = uint64([]); % Not used in CSR
4141
csr_ptrs = uint64([0, 1, 2, 3]); % Row pointers
42-
42+
4343
csr_matrix = bsp_matrix_create(csr_values, csr_rows, csr_cols, csr_ptrs, ...
4444
3, 3, 3, false, 'CSR', 'general');
4545
fprintf('CSR matrix created successfully\n');
4646
bsp_matrix_info(csr_matrix);
4747
fprintf('\n');
48-
48+
4949
% Test 4: Test field access
5050
fprintf('Test 4: Testing field access\n');
5151
fprintf('Matrix format: %s\n', csr_matrix.format);
5252
fprintf('Matrix structure: %s\n', csr_matrix.structure);
5353
fprintf('Is ISO: %s\n', mat2str(csr_matrix.is_iso));
5454
fprintf('First value: %.1f\n', csr_matrix.values(1));
5555
fprintf('\n');
56-
56+
5757
% Test 5: Test error handling
5858
fprintf('Test 5: Testing error handling\n');
5959
try
@@ -63,14 +63,14 @@ function test_bsp_matrix_struct()
6363
fprintf('Successfully caught error: %s\n', ME.message);
6464
end
6565
fprintf('\n');
66-
66+
6767
fprintf('=== All Tests Passed ===\n');
6868
fprintf('The Binsparse matrix struct is working correctly!\n');
69-
69+
7070
catch ME
7171
fprintf('=== TEST FAILED ===\n');
7272
fprintf('Error: %s\n', ME.message);
7373
rethrow(ME);
7474
end
7575

76-
end
76+
end

0 commit comments

Comments
 (0)