Skip to content

Commit 725be68

Browse files
fix: readme.md
--- 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: passed - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 8e9ce7e commit 725be68

File tree

2 files changed

+290
-0
lines changed

2 files changed

+290
-0
lines changed

lib/node_modules/@stdlib/blas/base/cdotu/README.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,150 @@ console.log( out.toString() );
187187

188188
<!-- /.examples -->
189189

190+
<!-- C interface documentation. -->
191+
192+
* * *
193+
194+
<section class="c">
195+
196+
## C APIs
197+
198+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
199+
200+
<section class="intro">
201+
202+
</section>
203+
204+
<!-- /.intro -->
205+
206+
<!-- C usage documentation. -->
207+
208+
<section class="usage">
209+
210+
### Usage
211+
212+
```c
213+
#include "stdlib/blas/base/cdotu.h"
214+
```
215+
216+
#### c_cdotu( N, \*X, strideX, \*Y, strideY, \*dot )
217+
218+
Calculates the dot product of two single-precision complex floating-point vectors.
219+
220+
```c
221+
#include "stdlib/complex/float32/ctor.h"
222+
223+
const float x[] = { 4.0f, 2.0f, -3.0f, 5.0f, -1.0f, 7.0f };
224+
const float y[] = { 2.0f, 6.0f, -1.0f, -4.0f, 8.0f, 9.0f };
225+
226+
stdlib_complex64_t dot;
227+
c_cdotu( 3, (void *)x, 1, (void *)y, 1, (void *)&dot );
228+
```
229+
230+
The function accepts the following arguments:
231+
232+
- **N**: `[in] CBLAS_INT` number of indexed elements.
233+
- **X**: `[in] void*` first input array.
234+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
235+
- **Y**: `[in] void*` second input array.
236+
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
237+
- **dot**: `[out] void*` output variable.
238+
239+
```c
240+
void c_cdotu( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const void *Y, const CBLAS_INT strideY, void *dot );
241+
```
242+
243+
#### c_cdotu_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY, \*dot )
244+
245+
Calculates the dot product of two single-precision complex floating-point vectors using alternative indexing semantics.
246+
247+
```c
248+
#include "stdlib/complex/float32/ctor.h"
249+
250+
const float x[] = { 4.0f, 2.0f, -3.0f, 5.0f, -1.0f, 7.0f };
251+
const float y[] = { 2.0f, 6.0f, -1.0f, -4.0f, 8.0f, 9.0f };
252+
253+
stdlib_complex64_t dot;
254+
c_cdotu_ndarray( 3, (void *)x, 1, 0, (void *)y, 1, 0, (void *)&dot );
255+
```
256+
257+
The function accepts the following arguments:
258+
259+
- **N**: `[in] CBLAS_INT` number of indexed elements.
260+
- **X**: `[in] void*` first input array.
261+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
262+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
263+
- **Y**: `[in] void*` second input array.
264+
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
265+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
266+
- **dot**: `[out] void*` output variable.
267+
268+
```c
269+
void c_cdotu_ndarray( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY, void *dot );
270+
```
271+
272+
</section>
273+
274+
<!-- /.usage -->
275+
276+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
277+
278+
<section class="notes">
279+
280+
</section>
281+
282+
<!-- /.notes -->
283+
284+
<!-- C API usage examples. -->
285+
286+
<section class="examples">
287+
288+
### Examples
289+
290+
```c
291+
#include "stdlib/blas/base/cdotu.h"
292+
#include "stdlib/complex/float32/real.h"
293+
#include "stdlib/complex/float32/imag.h"
294+
#include "stdlib/complex/float32/ctor.h"
295+
#include <stdio.h>
296+
297+
int main( void ) {
298+
// Create strided arrays:
299+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
300+
const float y[] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f };
301+
302+
// Specify the number of elements:
303+
const int N = 4;
304+
305+
// Specify strides:
306+
const int strideX = 1;
307+
const int strideY = 1;
308+
309+
// Create a complex number to store the result:
310+
stdlib_complex64_t z;
311+
312+
// Compute the dot product:
313+
c_cdotu( N, (const void *)x, strideX, (const void *)y, strideY, (void *)&z );
314+
315+
// Print the result:
316+
printf( "dot: %f + %fi\n", stdlib_complex64_real( z ), stdlib_complex64_imag( z ) );
317+
318+
// Compute the dot product:
319+
c_cdotu_ndarray( N, (const void *)x, strideX, 0, (const void *)y, strideY, 0, (void *)&z );
320+
321+
// Print the result:
322+
printf( "dot: %f + %fi\n", stdlib_complex64_real( z ), stdlib_complex64_imag( z ) );
323+
}
324+
```
325+
326+
</section>
327+
328+
<!-- /.examples -->
329+
330+
</section>
331+
332+
<!-- /.c -->
333+
190334
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
191335
192336
<section class="related">
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2020 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+
# VARIABLES #
20+
21+
ifndef VERBOSE
22+
QUIET := @
23+
else
24+
QUIET :=
25+
endif
26+
27+
# Determine the OS ([1][1], [2][2]).
28+
#
29+
# [1]: https://en.wikipedia.org/wiki/Uname#Examples
30+
# [2]: http://stackoverflow.com/a/27776822/2225624
31+
OS ?= $(shell uname)
32+
ifneq (, $(findstring MINGW,$(OS)))
33+
OS := WINNT
34+
else
35+
ifneq (, $(findstring MSYS,$(OS)))
36+
OS := WINNT
37+
else
38+
ifneq (, $(findstring CYGWIN,$(OS)))
39+
OS := WINNT
40+
else
41+
ifneq (, $(findstring Windows_NT,$(OS)))
42+
OS := WINNT
43+
endif
44+
endif
45+
endif
46+
endif
47+
48+
# Define the program used for compiling C source files:
49+
ifdef C_COMPILER
50+
CC := $(C_COMPILER)
51+
else
52+
CC := gcc
53+
endif
54+
55+
# Define the command-line options when compiling C files:
56+
CFLAGS ?= \
57+
-std=c99 \
58+
-O3 \
59+
-Wall \
60+
-pedantic
61+
62+
# Determine whether to generate position independent code ([1][1], [2][2]).
63+
#
64+
# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
65+
# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option
66+
ifeq ($(OS), WINNT)
67+
fPIC ?=
68+
else
69+
fPIC ?= -fPIC
70+
endif
71+
72+
# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
73+
INCLUDE ?=
74+
75+
# List of source files:
76+
SOURCE_FILES ?=
77+
78+
# List of libraries (e.g., `-lopenblas -lpthread`):
79+
LIBRARIES ?=
80+
81+
# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
82+
LIBPATH ?=
83+
84+
# List of C targets:
85+
c_targets := example.out
86+
87+
88+
# RULES #
89+
90+
#/
91+
# Compiles source files.
92+
#
93+
# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
94+
# @param {string} [CFLAGS] - C compiler options
95+
# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
96+
# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`)
97+
# @param {string} [SOURCE_FILES] - list of source files
98+
# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
99+
# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`)
100+
#
101+
# @example
102+
# make
103+
#
104+
# @example
105+
# make all
106+
#/
107+
all: $(c_targets)
108+
109+
.PHONY: all
110+
111+
#/
112+
# Compiles C source files.
113+
#
114+
# @private
115+
# @param {string} CC - C compiler (e.g., `gcc`)
116+
# @param {string} CFLAGS - C compiler options
117+
# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
118+
# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`)
119+
# @param {string} SOURCE_FILES - list of source files
120+
# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`)
121+
# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`)
122+
#/
123+
$(c_targets): %.out: %.c
124+
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
125+
126+
#/
127+
# Runs compiled examples.
128+
#
129+
# @example
130+
# make run
131+
#/
132+
run: $(c_targets)
133+
$(QUIET) ./$<
134+
135+
.PHONY: run
136+
137+
#/
138+
# Removes generated files.
139+
#
140+
# @example
141+
# make clean
142+
#/
143+
clean:
144+
$(QUIET) -rm -f *.o *.out
145+
146+
.PHONY: clean

0 commit comments

Comments
 (0)