Skip to content

Commit 2d24348

Browse files
docs: upgrade cdotc README
1 parent 3203733 commit 2d24348

1 file changed

Lines changed: 153 additions & 0 deletions

File tree

  • lib/node_modules/@stdlib/blas/base/cdotc

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

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,157 @@ console.log( out );
153153

154154
<!-- /.examples -->
155155

156+
<!-- C interface documentation. -->
157+
158+
* * *
159+
160+
<section class="c">
161+
162+
## C APIs
163+
164+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
165+
166+
<section class="intro">
167+
168+
</section>
169+
170+
<!-- /.intro -->
171+
172+
<!-- C usage documentation. -->
173+
174+
<section class="usage">
175+
176+
### Usage
177+
178+
```c
179+
#include "stdlib/blas/base/cdotc.h"
180+
```
181+
182+
#### c_cdotc( N, \*X, strideX, \*Y, strideY )
183+
184+
Calculates the dot product `x^H * y` of `x` and `y`.
185+
186+
```c
187+
#include "stdlib/complex/float32/ctor.h"
188+
189+
float x[] = { 7.0f, -8.0f, -1.0f, -9.0f };
190+
float y[] = { 6.0f, -6.0f, -9.0f, 5.0f };
191+
192+
stdlib_complex64_t out = c_cdotc( 2, (void *)x, 1, (void *)y, 1 );
193+
```
194+
195+
The function accepts the following arguments:
196+
197+
- **N**: `[in] CBLAS_INT` number of indexed elements.
198+
- **X**: `[in] void*` first input array.
199+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
200+
- **Y**: `[in] void*` second input array.
201+
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
202+
203+
```c
204+
stdlib_complex64_t c_cdotc( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const void *Y, const CBLAS_INT strideY );
205+
```
206+
207+
#### c_cdotc_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY )
208+
209+
Calculates the dot product `x^H * y` of `x` and `y` using alternative indexing semantics.
210+
211+
```c
212+
#include "stdlib/complex/float32/ctor.h"
213+
214+
float x[] = { 7.0f, -8.0f, -1.0f, -9.0f };
215+
float y[] = { 6.0f, -6.0f, -9.0f, 5.0f };
216+
217+
stdlib_complex64_t out = c_cdotc_ndarray( 2, (void *)x, 1, 0, (void *)y, 1, 0 );
218+
```
219+
220+
The function accepts the following arguments:
221+
222+
- **N**: `[in] CBLAS_INT` number of indexed elements.
223+
- **X**: `[in] void*` first input array.
224+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
225+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
226+
- **Y**: `[in] void*` second input array.
227+
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
228+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
229+
230+
```c
231+
stdlib_complex64_t c_cdotc_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 );
232+
```
233+
234+
</section>
235+
236+
<!-- /.usage -->
237+
238+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
239+
240+
<section class="notes">
241+
242+
</section>
243+
244+
<!-- /.notes -->
245+
246+
<!-- C API usage examples. -->
247+
248+
<section class="examples">
249+
250+
### Examples
251+
252+
```c
253+
#include "stdlib/blas/base/cdotc.h"
254+
#include "stdlib/complex/float32/ctor.h"
255+
#include "stdlib/complex/float32/reim.h"
256+
#include <stdio.h>
257+
258+
int main( void ) {
259+
// Create strided arrays of interleaved real and imaginary components:
260+
float x[] = { 7.0f, -8.0f, -1.0f, -9.0f };
261+
float y[] = { 6.0f, -6.0f, -9.0f, 5.0f };
262+
263+
// Specify the number of elements:
264+
const int N = 2;
265+
266+
// Specify stride lengths:
267+
const int strideX = 1;
268+
const int strideY = 1;
269+
270+
// Compute the dot product:
271+
stdlib_complex64_t dot = c_cdotc( N, (void *)x, strideX, (void *)y, strideY );
272+
273+
// Print the result:
274+
float re;
275+
float im;
276+
stdlib_complex64_reim( dot, &re, &im );
277+
printf( "cdotc( x, y ) = %f + %fi\n", re, im );
278+
279+
// Compute the dot product using alternative indexing semantics:
280+
dot = c_cdotc_ndarray( N, (void *)x, -strideX, 1, (void *)y, strideY, 0 );
281+
282+
// Print the result:
283+
stdlib_complex64_reim( dot, &re, &im );
284+
printf( "cdotc( x, y ) = %f + %fi\n", re, im );
285+
}
286+
```
287+
288+
</section>
289+
290+
<!-- /.examples -->
291+
292+
</section>
293+
294+
<!-- /.c -->
295+
156296
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
157297
158298
<section class="related">
159299
300+
* * *
301+
302+
## See Also
303+
304+
- <span class="package-name">[`@stdlib/blas/base/cdotu`][@stdlib/blas/base/cdotu]</span><span class="delimiter">: </span><span class="description">calculate the dot product of two single-precision complex floating-point vectors.</span>
305+
- <span class="package-name">[`@stdlib/blas/base/zdotc`][@stdlib/blas/base/zdotc]</span><span class="delimiter">: </span><span class="description">calculate the dot product of two double-precision complex floating-point vectors, conjugating the first vector.</span>
306+
160307
</section>
161308
162309
<!-- /.related -->
@@ -175,6 +322,12 @@ console.log( out );
175322
176323
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
177324
325+
<!-- <related-links> -->
326+
327+
[@stdlib/blas/base/cdotu]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/cdotu
328+
329+
[@stdlib/blas/base/zdotc]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/zdotc
330+
178331
<!-- </related-links> -->
179332
180333
</section>

0 commit comments

Comments
 (0)