Skip to content

Commit 659340f

Browse files
committed
docs: add types, types test and repl file
--- 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: passed - 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: passed - task: lint_license_headers status: passed ---
1 parent 2fa8a81 commit 659340f

3 files changed

Lines changed: 873 additions & 0 deletions

File tree

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
2+
{{alias}}( order, uplo, N, α, A, lda, x, sx, β, y, sy )
3+
Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β`
4+
are scalars, `x` and `y` are N element vectors, and `A` is an `N` by `N`
5+
Hermitian matrix.
6+
7+
Indexing is relative to the first index. To introduce an offset, use typed
8+
array views.
9+
10+
If `N` is equal to `0`, the function returns `y` unchanged.
11+
12+
If `α` equals `0 + 0i` and `β` equals `1 + 0i`, the function returns `y`
13+
unchanged.
14+
15+
Parameters
16+
----------
17+
order: string
18+
Row-major (C-style) or column-major (Fortran-style) order.
19+
20+
uplo: string
21+
Specifies whether the upper or lower triangular matrix of `A` is
22+
supplied. Must be either 'upper' or 'lower'.
23+
24+
N: integer
25+
Number of elements along each dimension of `A`.
26+
27+
α: Complex128
28+
Scalar constant.
29+
30+
A: Complex128Array
31+
Input matrix.
32+
33+
lda: integer
34+
Stride of the first dimension of `A` (a.k.a., leading dimension of the
35+
matrix `A`).
36+
37+
x: Complex128Array
38+
First input vector.
39+
40+
sx: integer
41+
Index increment for `x`.
42+
43+
β: Complex128
44+
Scalar constant.
45+
46+
y: Complex128Array
47+
Second input vector.
48+
49+
sy: integer
50+
Index increment for `y`.
51+
52+
Returns
53+
-------
54+
y: Complex128Array
55+
Second input vector.
56+
57+
Examples
58+
--------
59+
// Standard usage:
60+
> var x = new {{alias:@stdlib/array/complex128}}([1.0,1.0,2.0,2.0,3.0,3.0]);
61+
> var y = new {{alias:@stdlib/array/complex128}}([3.0,3.0,2.0,2.0,1.0,1.0]);
62+
> var buf1 = [1.0,0.0,0.0,0.0,0.0,0.0];
63+
> var buf2 = [2.0,-2.0,4.0,0.0,0.0,0.0];
64+
> var buf3 = [3.0,-3.0,5.0,-5.0,6.0,0.0];
65+
> var buf = buf1.concat( buf2, buf3 );
66+
> var A = new {{alias:@stdlib/array/complex128}}( buf );
67+
> var alpha = new {{alias:@stdlib/complex/float64/ctor}}(0.5,0.5);
68+
> var beta = new {{alias:@stdlib/complex/float64/ctor}}(0.5,-0.5);
69+
> var ord = 'row-major';
70+
> var uplo = 'lower';
71+
> {{alias}}( ord, uplo, 3, alpha, A, 3, x, 1, beta, y, 1 )
72+
<Complex128Array>[-10.0,14.0,-11.0,25.0,14.0,31.0]
73+
74+
// Advanced indexing:
75+
> x = new {{alias:@stdlib/array/complex128}}([3.0,3.0,2.0,2.0,1.0,1.0]);
76+
> y = new {{alias:@stdlib/array/complex128}}([1.0,1.0,2.0,2.0,3.0,3.0]);
77+
> buf1 = [1.0,0.0,0.0,0.0,0.0,0.0];
78+
> buf2 = [2.0,-2.0,4.0,0.0,0.0,0.0];
79+
> buf3 = [3.0,-3.0,5.0,-5.0,6.0,0.0];
80+
> buf = buf1.concat( buf2, buf3 );
81+
> A = new {{alias:@stdlib/array/complex128}}( buf );
82+
> alpha = new {{alias:@stdlib/complex/float64/ctor}}(0.5,0.5);
83+
> beta = new {{alias:@stdlib/complex/float64/ctor}}(0.5,-0.5);
84+
> ord = 'row-major';
85+
> uplo = 'lower';
86+
> {{alias}}( ord, uplo, 3, alpha, A, 3, x, -1, beta, y, -1 )
87+
<Complex128Array>[14.0,31.0,-11.0,25.0,-10.0,14.0]
88+
89+
// Using typed array views:
90+
> var x0buf = [0.0,0.0,3.0,3.0,2.0,2.0,1.0,1.0];
91+
> var x0 = new {{alias:@stdlib/array/complex128}}( x0buf );
92+
> var y0buf = [0.0,0.0,1.0,1.0,2.0,2.0,3.0,3.0];
93+
> var y0 = new {{alias:@stdlib/array/complex128}}( y0buf );
94+
> var x0bytes = x0.BYTES_PER_ELEMENT*1;
95+
> var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0bytes );
96+
> var y0bytes = y0.BYTES_PER_ELEMENT*1;
97+
> var y1 = new {{alias:@stdlib/array/complex128}}( y0.buffer, y0bytes );
98+
> buf1 = [1.0,0.0,0.0,0.0,0.0,0.0];
99+
> buf2 = [2.0,-2.0,4.0,0.0,0.0,0.0];
100+
> buf3 = [3.0,-3.0,5.0,-5.0,6.0,0.0];
101+
> buf = buf1.concat( buf2, buf3 );
102+
> A = new {{alias:@stdlib/array/complex128}}( buf );
103+
> alpha = new {{alias:@stdlib/complex/float64/ctor}}(0.5,0.5);
104+
> beta = new {{alias:@stdlib/complex/float64/ctor}}(0.5,-0.5);
105+
> ord = 'row-major';
106+
> uplo = 'lower';
107+
> {{alias}}( ord, uplo, 3, alpha, A, 3, x1, -1, beta, y1, -1 )
108+
<Complex128Array>[14.0,31.0,-11.0,25.0,-10.0,14.0]
109+
110+
111+
{{alias}}.ndarray( uplo, N, α, A, sa1, sa2, oa, x, sx, ox, β, y, sy, oy )
112+
Performs the matrix-vector operation `y = α*A*x + β*y` using alternative
113+
indexing semantics and, where `α` and `β` are scalars, `x` and `y` are N
114+
element vectors, and `A` is an `N` by `N` Hermitian matrix.
115+
116+
While typed array views mandate a view offset based on the underlying
117+
buffer, the offset parameters support indexing semantics based on starting
118+
indices.
119+
120+
Parameters
121+
----------
122+
uplo: string
123+
Specifies whether the upper or lower triangular matrix of `A` is
124+
supplied. Must be either 'upper' or 'lower'.
125+
126+
N: integer
127+
Number of columns in `A`.
128+
129+
α: Complex128
130+
Scalar constant.
131+
132+
A: Complex128Array
133+
Input matrix.
134+
135+
sa1: integer
136+
Stride of the first dimension of `A`.
137+
138+
sa2: integer
139+
Stride of the second dimension of `A`.
140+
141+
oa: integer
142+
Starting index (offset) for `A`.
143+
144+
x: Complex128Array
145+
First input vector.
146+
147+
sx: integer
148+
Index increment for `x`.
149+
150+
ox: integer
151+
Starting index (offset) for `x`.
152+
153+
β: Complex128
154+
Scalar constant.
155+
156+
y: Complex128Array
157+
Second input vector.
158+
159+
sy: integer
160+
Index increment for `y`.
161+
162+
oy: integer
163+
Starting index (offset) for `y`.
164+
165+
Returns
166+
-------
167+
y: Complex128Array
168+
Second input vector.
169+
170+
Examples
171+
--------
172+
> x = new {{alias:@stdlib/array/complex128}}([1.0,1.0,2.0,2.0,3.0,3.0]);
173+
> y = new {{alias:@stdlib/array/complex128}}([3.0,3.0,2.0,2.0,1.0,1.0]);
174+
> buf1 = [1.0,0.0,0.0,0.0,0.0,0.0];
175+
> buf2 = [2.0,-2.0,4.0,0.0,0.0,0.0];
176+
> buf3 = [3.0,-3.0,5.0,-5.0,6.0,0.0];
177+
> buf = buf1.concat( buf2, buf3 );
178+
> A = new {{alias:@stdlib/array/complex128}}( buf );
179+
> alpha = new {{alias:@stdlib/complex/float64/ctor}}(0.5,0.5);
180+
> beta = new {{alias:@stdlib/complex/float64/ctor}}(0.5,-0.5);
181+
> uplo = 'lower';
182+
> {{alias}}.ndarray(uplo,3,alpha,A,3,1,0,x,1,0,beta,y,1,0)
183+
<Complex128Array>[-10.0,14.0,-11.0,25.0,14.0,31.0]
184+
185+
See Also
186+
--------
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 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+
// TypeScript Version: 4.1
20+
21+
/// <reference types="@stdlib/types"/>
22+
23+
import { Complex128Array } from '@stdlib/types/array';
24+
import { Layout, MatrixTriangle } from '@stdlib/types/blas';
25+
import { Complex128 } from '@stdlib/types/complex';
26+
27+
/**
28+
* Interface describing `zhemv`.
29+
*/
30+
interface Routine {
31+
/**
32+
* Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` Hermitian matrix.
33+
*
34+
* @param order - storage layout
35+
* @param uplo - specifies whether `A` is an upper or lower triangular part of matrix is supplied.
36+
* @param N - number of elements along each dimension of `A`
37+
* @param alpha - scalar constant
38+
* @param A - input matrix
39+
* @param LDA - stride of the first dimension of `A`
40+
* @param x - first input vector
41+
* @param strideX - `x` stride length
42+
* @param beta - scalar constant
43+
* @param y - second input vector
44+
* @param strideY - `y` stride length
45+
* @returns `y`
46+
*
47+
* @example
48+
* var Complex128Array = require( '@stdlib/array/complex128' );
49+
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
50+
*
51+
* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, -2.0, 4.0, 0.0, 0.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] );
52+
* var x = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
53+
* var y = new Complex128Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );
54+
* var alpha = new Complex128( 0.5, 0.5 );
55+
* var beta = new Complex128( 0.5, -0.5 );
56+
*
57+
* zhemv( 'row-major', 'lower', 3, alpha, A, 3, x, 1, beta, y, 1 );
58+
* // y => <Complex128Array>[ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ]
59+
*/
60+
( order: Layout, uplo: MatrixTriangle, N: number, alpha: Complex128, A: Complex128Array, LDA: number, x: Complex128Array, strideX: number, beta: Complex128, y: Complex128Array, strideY: number ): Complex128Array;
61+
62+
/**
63+
* Performs the matrix-vector operation `y = α*A*x + β*y`, using alternative indexing semantics and where `α` and `β` are scalars, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` Hermitian matrix.
64+
*
65+
*
66+
* @param uplo - specifies whether `A` is an upper or lower triangular part of matrix is supplied.
67+
* @param N - number of elements along each dimension of `A`
68+
* @param alpha - scalar constant
69+
* @param A - input matrix
70+
* @param strideA1 - stride of the first dimension of `A`
71+
* @param strideA2 - stride of the second dimension of `A`
72+
* @param offsetA - starting index for `A`
73+
* @param x - first input vector
74+
* @param strideX - `x` stride length
75+
* @param offsetX - starting index for `x`
76+
* @param beta - scalar constant
77+
* @param y - second input vector
78+
* @param strideY - `y` stride length
79+
* @param offsetY - starting index for `y`
80+
* @returns `y`
81+
*
82+
* @example
83+
* var Complex128Array = require( '@stdlib/array/complex128' );
84+
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
85+
*
86+
* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, -2.0, 4.0, 0.0, 0.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] );
87+
* var x = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
88+
* var y = new Complex128Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );
89+
* var alpha = new Complex128( 0.5, 0.5 );
90+
* var beta = new Complex128( 0.5, -0.5 );
91+
*
92+
* zhemv.ndarray( 'lower', 3, alpha, A, 3, 1, 0, x, 1, 0, beta, y, 1, 0 );
93+
* // y => <Complex128Array>[ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ]
94+
*/
95+
ndarray( uplo: MatrixTriangle, N: number, alpha: Complex128, A: Complex128Array, strideA1: number, strideA2: number, offsetA: number, x: Complex128Array, strideX: number, offsetX: number, beta: Complex128, y: Complex128Array, strideY: number, offsetY: number ): Complex128Array;
96+
}
97+
98+
/**
99+
* Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are scalars, `x` and `y` are N element vectors, and `A` is an `N` by `N` Hermitian matrix.
100+
*
101+
* @param order - storage layout
102+
* @param uplo - specifies whether `A` is an upper or lower triangular part of matrix is supplied.
103+
* @param N - number of elements along each dimension of `A`
104+
* @param alpha - scalar constant
105+
* @param A - input matrix
106+
* @param LDA - stride of the first dimension of `A`
107+
* @param x - first input vector
108+
* @param strideX - `x` stride length
109+
* @param beta - scalar constant
110+
* @param y - second input vector
111+
* @param strideY - `y` stride length
112+
* @returns `y`
113+
*
114+
* @example
115+
* var Complex128Array = require( '@stdlib/array/complex128' );
116+
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
117+
*
118+
* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, -2.0, 4.0, 0.0, 0.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] );
119+
* var x = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
120+
* var y = new Complex128Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );
121+
* var alpha = new Complex128( 0.5, 0.5 );
122+
* var beta = new Complex128( 0.5, -0.5 );
123+
*
124+
* zhemv( 'row-major', 'lower', 3, alpha, A, 3, x, 1, beta, y, 1 );
125+
* // y => <Complex128Array>[ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ]
126+
*
127+
* @example
128+
* var Complex128Array = require( '@stdlib/array/complex128' );
129+
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
130+
*
131+
* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, -2.0, 4.0, 0.0, 0.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] );
132+
* var x = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
133+
* var y = new Complex128Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );
134+
* var alpha = new Complex128( 0.5, 0.5 );
135+
* var beta = new Complex128( 0.5, -0.5 );
136+
*
137+
* zhemv.ndarray( 'lower', 3, alpha, A, 3, 1, 0, x, 1, 0, beta, y, 1, 0 );
138+
* // y => <Complex128Array>[ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ]
139+
*/
140+
declare var zhemv: Routine;
141+
142+
143+
// EXPORTS //
144+
145+
export = zhemv;

0 commit comments

Comments
 (0)