Skip to content

Commit 1e5ea18

Browse files
committed
docs: shorter var names and add repl.txt
--- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 87e755f commit 1e5ea18

File tree

4 files changed

+253
-67
lines changed

4 files changed

+253
-67
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
2+
{{alias}}( N, DL, D, DU, DU2, IPIV )
3+
Computes an LU factorization of a real tri diagonal matrix A using
4+
elimination with partial pivoting and row interchanges.
5+
6+
Indexing is relative to the first index. To introduce an offset, use typed
7+
array views.
8+
9+
The function mutates `DL`, `D`, `DU`, `DU2` and `IPIV`.
10+
11+
Parameters
12+
----------
13+
N: integer
14+
Order of matrix `A`.
15+
16+
DL: Float64Array
17+
Sub diagonal elements of A. On exit, DL is overwritten by the
18+
multipliers that define the matrix L from the LU factorization of A.
19+
20+
D: Float64Array
21+
Diagonal elements of A. On exit, D is overwritten by the diagonal
22+
elements of the upper triangular matrix U from the LU factorization
23+
of A.
24+
25+
DU: Float64Array
26+
Super diagonal elements of A. On exit, DU is overwritten by the
27+
elements of the first super-diagonal of U.
28+
29+
DU2: Float64Array
30+
On exit, DU2 is overwritten by the elements of the second
31+
super-diagonal of U.
32+
33+
IPIV: Int32Array
34+
Array of pivot indices.
35+
36+
Returns
37+
-------
38+
info: integer
39+
Status code. The status code indicates the following conditions:
40+
41+
- if equal to zero, then the factorization was successful.
42+
- if less than zero, then the k-th argument had an illegal value, where
43+
`k = -info`.
44+
- if greater than zero, then U( k, k ) is exactly zero the factorization
45+
has been completed, but the factor U is exactly singular, and division
46+
by zero will occur if it is used to solve a system of equations,
47+
where `k = StatusCode`.
48+
49+
Examples
50+
--------
51+
> var DL = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
52+
> var D = new {{alias:@stdlib/array/float64}}( [ 2.0, 3.0, 1.0 ] );
53+
> var DU = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
54+
> var DU2 = new {{alias:@stdlib/array/float64}}( 1 );
55+
> var IPIV = new {{alias:@stdlib/array/int32}}( 3 );
56+
> {{alias}}( 3, DL, D, DU, DU2, IPIV )
57+
0
58+
> DL
59+
<Float64Array>[ 0.5, 0.4 ]
60+
> D
61+
<Float64Array>[ 2, 2.5, 0.6 ]
62+
> DU
63+
<Float64Array>[ 1, 1 ]
64+
> DU2
65+
<Float64Array>[ 0 ]
66+
67+
// Using typed array views:
68+
> var DL0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 1.0 ] );
69+
> var D0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 2.0, 3.0, 1.0 ] );
70+
> var DU0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 1.0 ] );
71+
> var DU2 = new {{alias:@stdlib/array/float64}}( 1 );
72+
> var IPIV = new {{alias:@stdlib/array/int32}}( 3 );
73+
> DL = new Float64Array( DL0.buffer, DL0.BYTES_PER_ELEMENT*1 );
74+
> D = new Float64Array( D0.buffer, D0.BYTES_PER_ELEMENT*1 );
75+
> DU = new Float64Array( DU0.buffer, DU0.BYTES_PER_ELEMENT*1 );
76+
> {{alias}}( 3, DL, D, DU, DU2, IPIV )
77+
0
78+
> DL
79+
<Float64Array>[ 0.5, 0.4 ]
80+
> D
81+
<Float64Array>[ 2, 2.5, 0.6 ]
82+
> DU
83+
<Float64Array>[ 1, 1 ]
84+
> DU2
85+
<Float64Array>[ 0 ]
86+
87+
88+
{{alias}}.ndarray( N, DL, sdl, odl, D, sd, od, DU, sdu, odu, DU2, sdu2, odu2, IPIV, si, oi )
89+
Computes an LU factorization of a real tri diagonal matrix A using
90+
elimination with partial pivoting and row interchanges and alternative
91+
indexing semantics.
92+
93+
While typed array views mandate a view offset based on the underlying
94+
buffer, the offset parameters support indexing semantics based on starting
95+
indices.
96+
97+
The function mutates `DL`, `D`, `DU`, `DU2` and `IPIV`.
98+
99+
Parameters
100+
----------
101+
N: integer
102+
Order of matrix `A`.
103+
104+
DL: Float64Array
105+
Sub diagonal elements of A. On exit, DL is overwritten by the
106+
multipliers that define the matrix L from the LU factorization of A.
107+
108+
sdl: integer
109+
Stride length for `DL`.
110+
111+
odl: integer
112+
Starting index for `DL`.
113+
114+
D: Float64Array
115+
Diagonal elements of A. On exit, D is overwritten by the diagonal
116+
elements of the upper triangular matrix U from the LU factorization
117+
of A.
118+
119+
sd: integer
120+
Stride length for `D`.
121+
122+
od: integer
123+
Starting index for `D`.
124+
125+
DU: Float64Array
126+
Super diagonal elements of A. On exit, DU is overwritten by the
127+
elements of the first super-diagonal of U.
128+
129+
sdu: integer
130+
Stride length for `DU`.
131+
132+
odu: integer
133+
Starting index for `DU2`.
134+
135+
DU2: Float64Array
136+
On exit, DU2 is overwritten by the elements of the second
137+
super-diagonal of U.
138+
139+
sdu2: integer
140+
Stride length for `DU2`.
141+
142+
odu2: integer
143+
Starting index for `DU2`.
144+
145+
IPIV: Int32Array
146+
Array of pivot indices.
147+
148+
si: integer
149+
Stride length for `IPIV`.
150+
151+
oi: integer
152+
Starting index for `IPIV`.
153+
154+
Returns
155+
-------
156+
info: integer
157+
Status code. The status code indicates the following conditions:
158+
159+
- if equal to zero, then the factorization was successful.
160+
- if less than zero, then the k-th argument had an illegal value, where
161+
`k = -info`.
162+
- if greater than zero, then U( k, k ) is exactly zero the factorization
163+
has been completed, but the factor U is exactly singular, and division
164+
by zero will occur if it is used to solve a system of equations,
165+
where `k = StatusCode`.
166+
167+
Examples
168+
--------
169+
> var DL = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
170+
> var D = new {{alias:@stdlib/array/float64}}( [ 2.0, 3.0, 1.0 ] );
171+
> var DU = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
172+
> var DU2 = new {{alias:@stdlib/array/float64}}( 1 );
173+
> var IPIV = new {{alias:@stdlib/array/int32}}( 3 );
174+
> {{alias}}.ndarray( 3, DL, 1, 0, D, 1, 0, DU, 1, 0, DU2, 1, 0, IPIV, 1, 0 )
175+
0
176+
> DL
177+
<Float64Array>[ 0.5, 0.4 ]
178+
> D
179+
<Float64Array>[ 2, 2.5, 0.6 ]
180+
> DU
181+
<Float64Array>[ 1, 1 ]
182+
> DU2
183+
<Float64Array>[ 0 ]
184+
185+
See Also
186+
--------

lib/node_modules/@stdlib/lapack/base/dgttrf/docs/types/index.d.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,20 @@ interface Routine {
6969
*
7070
* @param N - order of matrix `A`
7171
* @param DL - sub diagonal elements of `A`. On exit, `DL` is overwritten by the multipliers that define the matrix `L` from the LU factorization of `A`.
72-
* @param strideDL - stride length for `DL`
73-
* @param offsetDL - starting index of `DL`
72+
* @param sdl - stride length for `DL`
73+
* @param odl - starting index of `DL`
7474
* @param D - diagonal elements of `A`. On exit, `D` is overwritten by the diagonal elements of the upper triangular matrix `U` from the LU factorization of `A`.
75-
* @param strideD - stride length for `D`
76-
* @param offsetD - starting index of `D`
75+
* @param sd - stride length for `D`
76+
* @param od - starting index of `D`
7777
* @param DU - super diagonal elements of `A`. On exit, `DU` is overwritten by the elements of the first super-diagonal of `U`.
78-
* @param strideDU - stride length for `DU`
79-
* @param offsetDU - starting index of `DU`
78+
* @param sdu - stride length for `DU`
79+
* @param odu - starting index of `DU`
8080
* @param DU2 - On exit, `DU2` is overwritten by the elements of the second super-diagonal of `U`.
81-
* @param strideDU2 - stride length for `DU2`
82-
* @param offsetDU2 - starting index of `DU2`
81+
* @param sdu2 - stride length for `DU2`
82+
* @param odu2 - starting index of `DU2`
8383
* @param IPIV - vector of pivot indices
84-
* @param strideIPIV - stride length for `IPIV`
85-
* @param offsetIPIV - starting index of `IPIV`
84+
* @param si - stride length for `IPIV`
85+
* @param oi - starting index of `IPIV`
8686
* @returns status code
8787
*
8888
* @example
@@ -98,7 +98,7 @@ interface Routine {
9898
* // DU => <Float64Array>[ 1, 1 ]
9999
* // DU2 => <Float64Array>[ 0 ]
100100
*/
101-
ndarray( N: number, DL: Float64Array, strideDL: number, offsetDL: number, D: Float64Array, strideD: number, offsetD: number, DU: Float64Array, strideDU: number, offsetDU: number, DU2: Float64Array, strideDU2: number, offsetDU2: number, IPIV: Int32Array, strideIPIV: number, offsetIPIV: number ): StatusCode;
101+
ndarray( N: number, DL: Float64Array, sdl: number, odl: number, D: Float64Array, sd: number, od: number, DU: Float64Array, sdu: number, odu: number, DU2: Float64Array, sdu2: number, odu2: number, IPIV: Int32Array, si: number, oi: number ): StatusCode;
102102
}
103103

104104
/**

lib/node_modules/@stdlib/lapack/base/dgttrf/lib/base.js

+44-44
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ var abs = require( '@stdlib/math/base/special/abs' );
3131
* @private
3232
* @param {NonNegativeInteger} N - order of matrix A
3333
* @param {Float64Array} DL - sub diagonal elements of A. On exit, DL is overwritten by the multipliers that define the matrix L from the LU factorization of A.
34-
* @param {integer} strideDL - stride length for `DL`
35-
* @param {NonNegativeInteger} offsetDL - starting index of `DL`
34+
* @param {integer} sdl - stride length for `DL`
35+
* @param {NonNegativeInteger} odl - starting index of `DL`
3636
* @param {Float64Array} D - diagonal elements of A. On exit, D is overwritten by the diagonal elements of the upper triangular matrix U from the LU factorization of A.
37-
* @param {integer} strideD - stride length for `D`
38-
* @param {NonNegativeInteger} offsetD - starting index of `D`
37+
* @param {integer} sd - stride length for `D`
38+
* @param {NonNegativeInteger} od - starting index of `D`
3939
* @param {Float64Array} DU - super diagonal elements of A. On exit, DU is overwritten by the elements of the first super-diagonal of U.
40-
* @param {integer} strideDU - stride length for `DU`
41-
* @param {NonNegativeInteger} offsetDU - starting index of `DU`
40+
* @param {integer} sdu - stride length for `DU`
41+
* @param {NonNegativeInteger} odu - starting index of `DU`
4242
* @param {Float64Array} DU2 - On exit, DU2 is overwritten by the elements of the second super-diagonal of U.
43-
* @param {integer} strideDU2 - stride length for `DU2`
44-
* @param {NonNegativeInteger} offsetDU2 - starting index of `DU2`
43+
* @param {integer} sdu2 - stride length for `DU2`
44+
* @param {NonNegativeInteger} odu2 - starting index of `DU2`
4545
* @param {Int32Array} IPIV - vector of pivot indices
46-
* @param {integer} strideIPIV - stride length for `IPIV`
47-
* @param {NonNegativeInteger} offsetIPIV - starting index of `IPIV`
46+
* @param {integer} si - stride length for `IPIV`
47+
* @param {NonNegativeInteger} oi - starting index of `IPIV`
4848
* @returns {integer} status code
4949
*
5050
* @example
@@ -63,7 +63,7 @@ var abs = require( '@stdlib/math/base/special/abs' );
6363
* // DU => <Float64Array>[ 1, 1 ]
6464
* // DU2 => <Float64Array>[ 0 ]
6565
*/
66-
function dgttrf( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, offsetDU, DU2, strideDU2, offsetDU2, IPIV, strideIPIV, offsetIPIV ) { // eslint-disable-line max-len, max-params
66+
function dgttrf( N, DL, sdl, odl, D, sd, od, DU, sdu, odu, DU2, sdu2, odu2, IPIV, si, oi ) { // eslint-disable-line max-len, max-params
6767
var fact;
6868
var temp;
6969
var idu2;
@@ -77,61 +77,61 @@ function dgttrf( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, o
7777
return 0;
7878
}
7979

80-
idl = offsetDL;
81-
id = offsetD;
82-
idu = offsetDU;
83-
idu2 = offsetDU2;
84-
ip = offsetIPIV;
80+
idl = odl;
81+
id = od;
82+
idu = odu;
83+
idu2 = odu2;
84+
ip = oi;
8585

8686
for ( i = 0; i < N; i++ ) {
87-
IPIV[ ip + (strideIPIV*i) ] = i;
87+
IPIV[ ip + (si*i) ] = i;
8888
}
8989

9090
for ( i = 0; i < N-2; i++ ) {
91-
DU2[ idu + (strideDU*i) ] = 0;
91+
DU2[ idu + (sdu*i) ] = 0;
9292
}
9393

9494
for ( i = 0; i < N-2; i++ ) {
95-
if ( abs( D[ id + (strideD*i) ] ) >= abs( DL[ idl + (strideDL*i) ] ) ) { // no row interchange required
95+
if ( abs( D[ id + (sd*i) ] ) >= abs( DL[ idl + (sdl*i) ] ) ) { // no row interchange required
9696
if ( D[ id ] !== 0.0 ) {
97-
fact = DL[ idl + (strideDL*i) ] / D[ id + (strideD*i) ];
98-
DL[ idl + (strideDL*i) ] = fact;
99-
D[ id + (strideD*(i+1)) ] = D[ id + (strideD*(i+1)) ] - ( fact*DU[ idu + (strideDU*i) ] ); // eslint-disable-line max-len
97+
fact = DL[ idl + (sdl*i) ] / D[ id + (sd*i) ];
98+
DL[ idl + (sdl*i) ] = fact;
99+
D[ id + (sd*(i+1)) ] = D[ id + (sd*(i+1)) ] - ( fact*DU[ idu + (sdu*i) ] ); // eslint-disable-line max-len
100100
}
101101
} else {
102-
fact = D[ id+(strideD*i) ] / DL[ idl+(strideDL*i) ];
103-
D[ id+(strideD*i) ] = DL[ idl+(strideDL*i) ];
104-
DL[ idl+(strideDL*i) ] = fact;
105-
temp = DU[ idu+(strideDU*i) ];
106-
DU[ idu+(strideDU*i) ] = D[ id + (strideD*(i+1)) ];
107-
D[ id+(strideD*(i+1)) ] = temp - ( fact*D[ id+(strideD*(i+1)) ] );
108-
DU2[ idu2+(strideDU2*i) ] = DU[ idu+(strideDU*(i+1)) ];
109-
DU[ idu+(strideDU*(i+1)) ] = -fact*DU[ idu+(strideDU*(i+1)) ];
110-
IPIV[ ip+(strideIPIV*i) ] = i + 1;
102+
fact = D[ id+(sd*i) ] / DL[ idl+(sdl*i) ];
103+
D[ id+(sd*i) ] = DL[ idl+(sdl*i) ];
104+
DL[ idl+(sdl*i) ] = fact;
105+
temp = DU[ idu+(sdu*i) ];
106+
DU[ idu+(sdu*i) ] = D[ id + (sd*(i+1)) ];
107+
D[ id+(sd*(i+1)) ] = temp - ( fact*D[ id+(sd*(i+1)) ] );
108+
DU2[ idu2+(sdu2*i) ] = DU[ idu+(sdu*(i+1)) ];
109+
DU[ idu+(sdu*(i+1)) ] = -fact*DU[ idu+(sdu*(i+1)) ];
110+
IPIV[ ip+(si*i) ] = i + 1;
111111
}
112112
}
113113

114114
if ( N > 1 ) {
115115
i = N - 2;
116-
if ( abs( D[ id + (strideD*i) ] ) >= abs( DL[ idl + (strideDL*i) ] ) ) {
117-
if ( D[ id + (strideD*i) ] !== 0 ) {
118-
fact = DL[ idl + (strideDL*i) ] / D[ id + (strideD*i) ];
119-
DL[ idl + (strideDL*i) ] = fact;
120-
D[ id + (strideD*(i+1)) ] = D[ id + (strideD*(i+1)) ] - (fact*DU[ idu + (strideDU*i) ]); // eslint-disable-line max-len
116+
if ( abs( D[ id + (sd*i) ] ) >= abs( DL[ idl + (sdl*i) ] ) ) {
117+
if ( D[ id + (sd*i) ] !== 0 ) {
118+
fact = DL[ idl + (sdl*i) ] / D[ id + (sd*i) ];
119+
DL[ idl + (sdl*i) ] = fact;
120+
D[ id + (sd*(i+1)) ] = D[ id + (sd*(i+1)) ] - (fact*DU[ idu + (sdu*i) ]); // eslint-disable-line max-len
121121
}
122122
} else {
123-
fact = D[ id+(strideD*i) ] / DL[ idl+(strideDL*i) ];
124-
D[ id+(strideD*i) ] = DL[ idl+(strideDL*i) ];
125-
DL[ idl+(strideDL*i) ] = fact;
126-
temp = DU[ idu+(strideDU*i) ];
127-
DU[ idu+(strideDU*i) ] = D[ id + (strideD*(i+1)) ];
128-
D[ id+(strideD*(i+1)) ] = temp - ( fact*D[ id+(strideD*(i+1)) ] );
129-
IPIV[ ip+(strideIPIV*i) ] = i + 1;
123+
fact = D[ id+(sd*i) ] / DL[ idl+(sdl*i) ];
124+
D[ id+(sd*i) ] = DL[ idl+(sdl*i) ];
125+
DL[ idl+(sdl*i) ] = fact;
126+
temp = DU[ idu+(sdu*i) ];
127+
DU[ idu+(sdu*i) ] = D[ id + (sd*(i+1)) ];
128+
D[ id+(sd*(i+1)) ] = temp - ( fact*D[ id+(sd*(i+1)) ] );
129+
IPIV[ ip+(si*i) ] = i + 1;
130130
}
131131
}
132132

133133
for ( i = 0; i < N; i++ ) {
134-
if ( D[ id+(strideD*i) ] === 0.0 ) {
134+
if ( D[ id+(sd*i) ] === 0.0 ) {
135135
return i;
136136
}
137137
}

0 commit comments

Comments
 (0)