Skip to content

Commit 4ec819b

Browse files
kgrytesaurabhraghuvanshii
authored andcommitted
feat: add header files
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 5a1df4e commit 4ec819b

File tree

4 files changed

+218
-0
lines changed

4 files changed

+218
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_DISPATCH_H
20+
#define STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_DISPATCH_H
21+
22+
#include "stdlib/ndarray/base/unary-accumulate/dispatch_object.h"
23+
#include "stdlib/ndarray/ctor.h"
24+
#include <stdint.h>
25+
26+
/*
27+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
28+
*/
29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
33+
/**
34+
* Dispatches to a ndarray function according to the dimensionality of provided ndarray arguments.
35+
*/
36+
int8_t stdlib_ndarray_unary_accumulate_dispatch( const struct ndarrayUnaryAccumulateDispatchObject *obj, struct ndarray *arrays[], void *fcn );
37+
38+
#ifdef __cplusplus
39+
}
40+
#endif
41+
42+
#endif // !STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_DISPATCH_H
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_DISPATCH_OBJECT_H
20+
#define STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_DISPATCH_OBJECT_H
21+
22+
#include "stdlib/ndarray/base/unary-accumulate/typedefs.h"
23+
#include <stdint.h>
24+
25+
/*
26+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
27+
*/
28+
#ifdef __cplusplus
29+
extern "C" {
30+
#endif
31+
32+
/**
33+
* Structure for grouping function dispatch information.
34+
*
35+
* @example
36+
* #include "stdlib/ndarray/base/unary-accumulate/bb_b.h"
37+
* #include <stdlib.h>
38+
* #include <stdio.h>
39+
*
40+
* ndarrayUnaryAccumulateFcn functions[] = {
41+
* stdlib_ndarray_bb_b_0d,
42+
* stdlib_ndarray_bb_b_1d,
43+
* stdlib_ndarray_bb_b_2d,
44+
* stdlib_ndarray_bb_b_3d,
45+
* stdlib_ndarray_bb_b_4d,
46+
* stdlib_ndarray_bb_b_5d,
47+
* stdlib_ndarray_bb_b_6d,
48+
* stdlib_ndarray_bb_b_7d,
49+
* stdlib_ndarray_bb_b_8d,
50+
* stdlib_ndarray_bb_b_9d,
51+
* stdlib_ndarray_bb_b_10d
52+
* stdlib_ndarray_bb_b_nd
53+
* };
54+
55+
* ndarrayUnaryAccumulateFcn blocked_functions[] = {
56+
* stdlib_ndarray_bb_b_2d_blocked,
57+
* stdlib_ndarray_bb_b_3d_blocked,
58+
* stdlib_ndarray_bb_b_4d_blocked,
59+
* stdlib_ndarray_bb_b_5d_blocked,
60+
* stdlib_ndarray_bb_b_6d_blocked,
61+
* stdlib_ndarray_bb_b_7d_blocked,
62+
* stdlib_ndarray_bb_b_8d_blocked,
63+
* stdlib_ndarray_bb_b_9d_blocked,
64+
* stdlib_ndarray_bb_b_10d_blocked
65+
* };
66+
*
67+
* ndarrayUnaryAccumulateDispatchObject obj = {
68+
* functions,
69+
* 12,
70+
* blocked_functions
71+
* 9
72+
* };
73+
*
74+
* // ...
75+
*/
76+
struct ndarrayUnaryAccumulateDispatchObject {
77+
// Array containing ndarray functions for performing accumulation:
78+
ndarrayUnaryAccumulateFcn *functions;
79+
80+
// Number of ndarray functions:
81+
int32_t nfunctions;
82+
83+
// Array containing ndarray functions for performing accumulation using loop blocking:
84+
ndarrayUnaryAccumulateFcn *blocked_functions;
85+
86+
// Number of blocked ndarray functions:
87+
int32_t nblockedfunctions;
88+
};
89+
90+
#ifdef __cplusplus
91+
}
92+
#endif
93+
94+
#endif // !STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_DISPATCH_OBJECT_H
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_MACROS_H
20+
#define STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_MACROS_H
21+
22+
#include "stdlib/ndarray/base/unary-accumulate/macros/constants.h"
23+
#include "stdlib/ndarray/base/unary-accumulate/macros/1d.h"
24+
#include "stdlib/ndarray/base/unary-accumulate/macros/2d.h"
25+
#include "stdlib/ndarray/base/unary-accumulate/macros/2d_blocked.h"
26+
#include "stdlib/ndarray/base/unary-accumulate/macros/3d.h"
27+
#include "stdlib/ndarray/base/unary-accumulate/macros/3d_blocked.h"
28+
#include "stdlib/ndarray/base/unary-accumulate/macros/4d.h"
29+
#include "stdlib/ndarray/base/unary-accumulate/macros/4d_blocked.h"
30+
#include "stdlib/ndarray/base/unary-accumulate/macros/5d.h"
31+
#include "stdlib/ndarray/base/unary-accumulate/macros/5d_blocked.h"
32+
#include "stdlib/ndarray/base/unary-accumulate/macros/6d.h"
33+
#include "stdlib/ndarray/base/unary-accumulate/macros/6d_blocked.h"
34+
#include "stdlib/ndarray/base/unary-accumulate/macros/7d.h"
35+
#include "stdlib/ndarray/base/unary-accumulate/macros/7d_blocked.h"
36+
#include "stdlib/ndarray/base/unary-accumulate/macros/8d.h"
37+
#include "stdlib/ndarray/base/unary-accumulate/macros/8d_blocked.h"
38+
#include "stdlib/ndarray/base/unary-accumulate/macros/9d.h"
39+
#include "stdlib/ndarray/base/unary-accumulate/macros/9d_blocked.h"
40+
#include "stdlib/ndarray/base/unary-accumulate/macros/10d.h"
41+
#include "stdlib/ndarray/base/unary-accumulate/macros/10d_blocked.h"
42+
#include "stdlib/ndarray/base/unary-accumulate/macros/nd.h"
43+
44+
#endif // !STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_MACROS_H
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_TYPEDEFS_H
20+
#define STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_TYPEDEFS_H
21+
22+
#include "stdlib/ndarray/ctor.h"
23+
#include <stdint.h>
24+
25+
/**
26+
* Function pointer type for a unary ndarray function.
27+
*
28+
* ## Note
29+
*
30+
* - This must match the definition of an `ndarrayFcn` found in `@stdlib/ndarray/base/function-object`.
31+
*
32+
* @param arrays array containing pointers to input and output ndarrays
33+
* @param data function "data" (e.g., a callback)
34+
* @return status code
35+
*/
36+
typedef int8_t (*ndarrayUnaryAccumulateFcn)( struct ndarray *arrays[], void *data );
37+
38+
#endif // !STDLIB_NDARRAY_BASE_UNARY_ACCUMULATE_TYPEDEFS_H

0 commit comments

Comments
 (0)