@stdlib/lapack-base-dpttrf 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
package/NOTICE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2016-2024 The Stdlib Authors.
package/README.md ADDED
@@ -0,0 +1,347 @@
1
+ <!--
2
+
3
+ @license Apache-2.0
4
+
5
+ Copyright (c) 2024 The Stdlib Authors.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ -->
20
+
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
32
+ # dpttrf
33
+
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
35
+
36
+ > Compute the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.
37
+
38
+ <section class = "usage">
39
+
40
+ ## Usage
41
+
42
+ ```javascript
43
+ var dpttrf = require( '@stdlib/lapack-base-dpttrf' );
44
+ ```
45
+
46
+ #### dpttrf( N, D, E )
47
+
48
+ Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.
49
+
50
+ ```javascript
51
+ var Float64Array = require( '@stdlib/array-float64' );
52
+
53
+ var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
54
+ var E = new Float64Array( [ 1.0, 2.0 ] );
55
+
56
+ dpttrf( 3, D, E );
57
+ // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
58
+ // E => <Float64Array>[ 0.25, ~0.4210 ]
59
+ ```
60
+
61
+ The function has the following parameters:
62
+
63
+ - **N**: order of matrix `A`.
64
+ - **D**: the `N` diagonal elements of `A` as a [`Float64Array`][mdn-float64array].
65
+ - **E**: the N-1 subdiagonal elements of `A` as a [`Float64Array`][mdn-float64array].
66
+
67
+ Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
68
+
69
+ <!-- eslint-disable stdlib/capitalized-comments -->
70
+
71
+ ```javascript
72
+ var Float64Array = require( '@stdlib/array-float64' );
73
+
74
+ // Initial arrays...
75
+ var D0 = new Float64Array( [ 0.0, 4.0, 5.0, 6.0 ] );
76
+ var E0 = new Float64Array( [ 0.0, 1.0, 2.0 ] );
77
+
78
+ // Create offset views...
79
+ var D1 = new Float64Array( D0.buffer, D0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
80
+ var E1 = new Float64Array( E0.buffer, E0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
81
+
82
+ dpttrf( 3, D1, E1 );
83
+ // D0 => <Float64Array>[ 0.0, 4.0, 4.75, ~5.15789 ]
84
+ // E0 => <Float64Array>[ 0.0, 0.25, ~0.4210 ]
85
+ ```
86
+
87
+ #### dpttrf.ndarray( N, D, strideD, offsetD, E, strideE, offsetE )
88
+
89
+ Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A` using alternative indexing semantics.
90
+
91
+ ```javascript
92
+ var Float64Array = require( '@stdlib/array-float64' );
93
+
94
+ var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
95
+ var E = new Float64Array( [ 1.0, 2.0 ] );
96
+
97
+ dpttrf.ndarray( 3, D, 1, 0, E, 1, 0 );
98
+ // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
99
+ // E => <Float64Array>[ 0.25, ~0.4210 ]
100
+ ```
101
+
102
+ The function has the following additional parameters:
103
+
104
+ - **strideD**: stride length for `D`.
105
+ - **offsetD**: starting index for `D`.
106
+ - **strideE**: stride length for `E`.
107
+ - **offsetE**: starting index for `E`.
108
+
109
+ While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example,
110
+
111
+ <!-- eslint-disable max-len -->
112
+
113
+ ```javascript
114
+ var Float64Array = require( '@stdlib/array-float64' );
115
+
116
+ var D = new Float64Array( [ 0.0, 4.0, 5.0, 6.0 ] );
117
+ var E = new Float64Array( [ 0.0, 1.0, 2.0 ] );
118
+
119
+ dpttrf.ndarray( 3, D, 1, 1, E, 1, 1 );
120
+ // D => <Float64Array>[ 0.0, 4.0, 4.75, ~5.15789 ]
121
+ // E => <Float64Array>[ 0.0, 0.25, ~0.4210 ]
122
+ ```
123
+
124
+ </section>
125
+
126
+ <!-- /.usage -->
127
+
128
+ <section class="notes">
129
+
130
+ ## Notes
131
+
132
+ - Both functions mutate the input arrays `D` and `E`.
133
+
134
+ - Both functions return a status code indicating success or failure. A status code indicates the following conditions:
135
+
136
+ - `0`: factorization was successful.
137
+ - `<0`: the k-th argument had an illegal value, where `-k` equals the status code value.
138
+ - `0 < k < N`: the leading principal minor of order `k` is not positive and factorization could not be completed, where `k` equals the status code value.
139
+ - `N`: the leading principal minor of order `N` is not positive, and factorization was completed.
140
+
141
+ - `dpttrf()` corresponds to the [LAPACK][LAPACK] routine [`dpttrf`][lapack-dpttrf].
142
+
143
+ </section>
144
+
145
+ <!-- /.notes -->
146
+
147
+ <section class="examples">
148
+
149
+ ## Examples
150
+
151
+ <!-- eslint no-undef: "error" -->
152
+
153
+ ```javascript
154
+ var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
155
+ var dpttrf = require( '@stdlib/lapack-base-dpttrf' );
156
+
157
+ var opts = {
158
+ 'dtype': 'float64'
159
+ };
160
+ var D = discreteUniform( 5, 1, 5, opts );
161
+ console.log( D );
162
+
163
+ var E = discreteUniform( D.length-1, 1, 5, opts );
164
+ console.log( E );
165
+
166
+ // Perform the `L * D * L^T` factorization:
167
+ var info = dpttrf( D.length, D, E );
168
+ console.log( D );
169
+ console.log( E );
170
+ console.log( info );
171
+ ```
172
+
173
+ </section>
174
+
175
+ <!-- /.examples -->
176
+
177
+ <!-- C interface documentation. -->
178
+
179
+ * * *
180
+
181
+ <section class="c">
182
+
183
+ ## C APIs
184
+
185
+ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
186
+
187
+ <section class="intro">
188
+
189
+ </section>
190
+
191
+ <!-- /.intro -->
192
+
193
+ <!-- C usage documentation. -->
194
+
195
+ <section class="installation">
196
+
197
+ ## Installation
198
+
199
+ ```bash
200
+ npm install @stdlib/lapack-base-dpttrf
201
+ ```
202
+
203
+ </section>
204
+
205
+ <section class="usage">
206
+
207
+ ### Usage
208
+
209
+ ```c
210
+ TODO
211
+ ```
212
+
213
+ #### TODO
214
+
215
+ TODO.
216
+
217
+ ```c
218
+ TODO
219
+ ```
220
+
221
+ TODO
222
+
223
+ ```c
224
+ TODO
225
+ ```
226
+
227
+ </section>
228
+
229
+ <!-- /.usage -->
230
+
231
+ <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
232
+
233
+ <section class="notes">
234
+
235
+ </section>
236
+
237
+ <!-- /.notes -->
238
+
239
+ <!-- C API usage examples. -->
240
+
241
+ <section class="examples">
242
+
243
+ ### Examples
244
+
245
+ ```c
246
+ TODO
247
+ ```
248
+
249
+ </section>
250
+
251
+ <!-- /.examples -->
252
+
253
+ </section>
254
+
255
+ <!-- /.c -->
256
+
257
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
258
+
259
+ <section class="related">
260
+
261
+ </section>
262
+
263
+ <!-- /.related -->
264
+
265
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
266
+
267
+
268
+ <section class="main-repo" >
269
+
270
+ * * *
271
+
272
+ ## Notice
273
+
274
+ This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
275
+
276
+ For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
277
+
278
+ #### Community
279
+
280
+ [![Chat][chat-image]][chat-url]
281
+
282
+ ---
283
+
284
+ ## License
285
+
286
+ See [LICENSE][stdlib-license].
287
+
288
+
289
+ ## Copyright
290
+
291
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
292
+
293
+ </section>
294
+
295
+ <!-- /.stdlib -->
296
+
297
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
298
+
299
+ <section class="links">
300
+
301
+ [npm-image]: http://img.shields.io/npm/v/@stdlib/lapack-base-dpttrf.svg
302
+ [npm-url]: https://npmjs.org/package/@stdlib/lapack-base-dpttrf
303
+
304
+ [test-image]: https://github.com/stdlib-js/lapack-base-dpttrf/actions/workflows/test.yml/badge.svg?branch=v0.1.0
305
+ [test-url]: https://github.com/stdlib-js/lapack-base-dpttrf/actions/workflows/test.yml?query=branch:v0.1.0
306
+
307
+ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/lapack-base-dpttrf/main.svg
308
+ [coverage-url]: https://codecov.io/github/stdlib-js/lapack-base-dpttrf?branch=main
309
+
310
+ <!--
311
+
312
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/lapack-base-dpttrf.svg
313
+ [dependencies-url]: https://david-dm.org/stdlib-js/lapack-base-dpttrf/main
314
+
315
+ -->
316
+
317
+ [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
318
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
319
+
320
+ [stdlib]: https://github.com/stdlib-js/stdlib
321
+
322
+ [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
323
+
324
+ [umd]: https://github.com/umdjs/umd
325
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
326
+
327
+ [deno-url]: https://github.com/stdlib-js/lapack-base-dpttrf/tree/deno
328
+ [deno-readme]: https://github.com/stdlib-js/lapack-base-dpttrf/blob/deno/README.md
329
+ [umd-url]: https://github.com/stdlib-js/lapack-base-dpttrf/tree/umd
330
+ [umd-readme]: https://github.com/stdlib-js/lapack-base-dpttrf/blob/umd/README.md
331
+ [esm-url]: https://github.com/stdlib-js/lapack-base-dpttrf/tree/esm
332
+ [esm-readme]: https://github.com/stdlib-js/lapack-base-dpttrf/blob/esm/README.md
333
+ [branches-url]: https://github.com/stdlib-js/lapack-base-dpttrf/blob/main/branches.md
334
+
335
+ [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/lapack-base-dpttrf/main/LICENSE
336
+
337
+ [lapack]: https://www.netlib.org/lapack/explore-html/
338
+
339
+ [lapack-dpttrf]: https://www.netlib.org/lapack/explore-html/d4/d2c/group__pttrf_ga8f112041da2b9b443f8761a1eaaf15b6.html#ga8f112041da2b9b443f8761a1eaaf15b6
340
+
341
+ [mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array
342
+
343
+ [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
344
+
345
+ </section>
346
+
347
+ <!-- /.links -->
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import dpttrf from '../docs/types/index';
3
+ export = dpttrf;
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";var s=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var q=s(function(I,p){
2
+ function j(r,e,i,v,a,o,f){var t,n,d,u;if(r===0)return 0;for(n=f,t=v,u=0;u<r-1;u++){if(e[t]<=0)return u+1;d=a[n],a[n]=d/e[t],t+=i,e[t]-=a[n]*d,n+=o}return e[t]<=0?r:0}p.exports=j
3
+ });var c=s(function(J,g){
4
+ var h=require('@stdlib/error-tools-fmtprodmsg/dist'),F=q();function V(r,e,i){if(r<0)throw new RangeError(h("invalid argument. First argument must be a nonnegative integer. Value: `%d`.",r));return F(r,e,1,0,i,1,0)}g.exports=V
5
+ });var x=s(function(K,l){
6
+ var _=require('@stdlib/error-tools-fmtprodmsg/dist'),E=q();function O(r,e,i,v,a,o,f){if(r<0)throw new RangeError(_("invalid argument. First argument must be a nonnegative integer. Value: `%d`.",r));return E(r,e,i,v,a,o,f)}l.exports=O
7
+ });var y=s(function(L,w){
8
+ var k=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),b=c(),z=x();k(b,"ndarray",z);w.exports=b
9
+ });var A=require("path").join,B=require('@stdlib/utils-try-require/dist'),C=require('@stdlib/assert-is-error/dist'),G=y(),m,R=B(A(__dirname,"./native.js"));C(R)?m=G:m=R;module.exports=m;
10
+ /** @license Apache-2.0 */
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/base.js", "../lib/dpttrf.js", "../lib/ndarray.js", "../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.\n*\n* @private\n* @param {NonNegativeInteger} N - order of matrix `A`\n* @param {Float64Array} D - the `N` diagonal elements of `A`\n* @param {integer} strideD - stride length for `D`\n* @param {NonNegativeInteger} offsetD - starting index of `D`\n* @param {Float64Array} E - the `N-1` subdiagonal elements of `A`\n* @param {integer} strideE - stride length for `E`\n* @param {NonNegativeInteger} offsetE - starting index of `E`\n* @returns {integer} status code\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );\n* var E = new Float64Array( [ 1.0, 2.0 ] );\n*\n* dpttrf( 3, D, 1, 0, E, 1, 0 );\n* // D => <Float64Array>[ 4, 4.75, ~5.15789 ]\n* // E => <Float64Array>[ 0.25, ~0.4210 ]\n*/\nfunction dpttrf( N, D, strideD, offsetD, E, strideE, offsetE ) {\n\tvar id;\n\tvar ie;\n\tvar v;\n\tvar i;\n\n\tif ( N === 0 ) {\n\t\treturn 0;\n\t}\n\tie = offsetE;\n\tid = offsetD;\n\n\t// Compute the `L * D * L^T` factorization of `A`...\n\tfor ( i = 0; i < N-1; i++ ) {\n\t\t// If `D[k] <= 0`, then the matrix is not positive definite...\n\t\tif ( D[ id ] <= 0.0 ) {\n\t\t\treturn i+1;\n\t\t}\n\t\t// Solve for E[k] and D[k+1]...\n\t\tv = E[ ie ];\n\t\tE[ ie ] = v / D[ id ];\n\n\t\tid += strideD;\n\t\tD[ id ] -= E[ ie ] * v;\n\n\t\tie += strideE;\n\t}\n\t// Check `D[k]` for positive definiteness...\n\tif ( D[ id ] <= 0.0 ) {\n\t\treturn N;\n\t}\n\treturn 0;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dpttrf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar format = require( '@stdlib/string-format' );\nvar base = require( './base.js' );\n\n\n// MAIN //\n\n/**\n* Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.\n*\n* @param {NonNegativeInteger} N - order of matrix `A`\n* @param {Float64Array} D - the `N` diagonal elements of `A`\n* @param {Float64Array} E - the `N-1` subdiagonal elements of `A`\n* @throws {RangeError} first argument must be a nonnegative integer\n* @returns {integer} status code\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );\n* var E = new Float64Array( [ 1.0, 2.0 ] );\n*\n* dpttrf( 3, D, E );\n* // D => <Float64Array>[ 4, 4.75, ~5.15789 ]\n* // E => <Float64Array>[ 0.25, ~0.4210 ]\n*/\nfunction dpttrf( N, D, E ) {\n\tif ( N < 0 ) {\n\t\tthrow new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) );\n\t}\n\treturn base( N, D, 1, 0, E, 1, 0 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dpttrf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar format = require( '@stdlib/string-format' );\nvar base = require( './base.js' );\n\n\n// MAIN //\n\n/**\n* Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A` using alternative indexing semantics.\n*\n* @param {NonNegativeInteger} N - order of matrix `A`\n* @param {Float64Array} D - the `N` diagonal elements of `A`\n* @param {integer} strideD - stride length for `D`\n* @param {NonNegativeInteger} offsetD - starting index of `D`\n* @param {Float64Array} E - the `N-1` subdiagonal elements of `A`\n* @param {integer} strideE - stride length for `E`\n* @param {NonNegativeInteger} offsetE - starting index of `E`\n* @throws {RangeError} first argument must be a nonnegative integer\n* @returns {integer} status code\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );\n* var E = new Float64Array( [ 1.0, 2.0 ] );\n*\n* dpttrf( 3, D, 1, 0, E, 1, 0 );\n* // D => <Float64Array>[ 4, 4.75, ~5.15789 ]\n* // E => <Float64Array>[ 0.25, ~0.4210 ]\n*/\nfunction dpttrf( N, D, strideD, offsetD, E, strideE, offsetE ) {\n\tif ( N < 0 ) {\n\t\tthrow new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) );\n\t}\n\treturn base( N, D, strideD, offsetD, E, strideE, offsetE );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dpttrf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar dpttrf = require( './dpttrf.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dpttrf, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dpttrf;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* LAPACK routine to compute the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.\n*\n* @module @stdlib/lapack-base-dpttrf\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dpttrf = require( '@stdlib/lapack-base-dpttrf' );\n*\n* var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );\n* var E = new Float64Array( [ 1.0, 2.0 ] );\n*\n* dpttrf( 3, D, E );\n* // D => <Float64Array>[ 4, 4.75, ~5.15789 ]\n* // E => <Float64Array>[ 0.25, ~0.4210 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dpttrf = require( '@stdlib/lapack-base-dpttrf' );\n*\n* var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );\n* var E = new Float64Array( [ 1.0, 2.0 ] );\n*\n* dpttrf.ndarray( 3, D, 1, 0, E, 1, 0 );\n* // D => <Float64Array>[ 4, 4.75, ~5.15789 ]\n* // E => <Float64Array>[ 0.25, ~0.4210 ]\n*/\n\n// MODULES //\n\nvar join = require( 'path' ).join;\nvar tryRequire = require( '@stdlib/utils-try-require' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar main = require( './main.js' );\n\n\n// MAIN //\n\nvar dpttrf;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdpttrf = main;\n} else {\n\tdpttrf = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dpttrf;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA6CA,SAASC,EAAQC,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAAU,CAC9D,IAAIC,EACAC,EACAC,EACAC,EAEJ,GAAKV,IAAM,EACV,MAAO,GAMR,IAJAQ,EAAKF,EACLC,EAAKJ,EAGCO,EAAI,EAAGA,EAAIV,EAAE,EAAGU,IAAM,CAE3B,GAAKT,EAAGM,CAAG,GAAK,EACf,OAAOG,EAAE,EAGVD,EAAIL,EAAGI,CAAG,EACVJ,EAAGI,CAAG,EAAIC,EAAIR,EAAGM,CAAG,EAEpBA,GAAML,EACND,EAAGM,CAAG,GAAKH,EAAGI,CAAG,EAAIC,EAErBD,GAAMH,CACP,CAEA,OAAKJ,EAAGM,CAAG,GAAK,EACRP,EAED,CACR,CAKAF,EAAO,QAAUC,IClFjB,IAAAY,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,QAAS,uBAAwB,EAC1CC,EAAO,IAwBX,SAASC,EAAQC,EAAGC,EAAGC,EAAI,CAC1B,GAAKF,EAAI,EACR,MAAM,IAAI,WAAYH,EAAQ,+EAAgFG,CAAE,CAAE,EAEnH,OAAOF,EAAME,EAAGC,EAAG,EAAG,EAAGC,EAAG,EAAG,CAAE,CAClC,CAKAN,EAAO,QAAUG,ICzDjB,IAAAI,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,QAAS,uBAAwB,EAC1CC,EAAO,IA4BX,SAASC,EAAQC,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAAU,CAC9D,GAAKN,EAAI,EACR,MAAM,IAAI,WAAYH,EAAQ,+EAAgFG,CAAE,CAAE,EAEnH,OAAOF,EAAME,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,CAAQ,CAC1D,CAKAV,EAAO,QAAUG,IC7DjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAS,IACTC,EAAU,IAKdF,EAAaC,EAAQ,UAAWC,CAAQ,EAKxCH,EAAO,QAAUE,ICgBjB,IAAIE,EAAO,QAAS,MAAO,EAAE,KACzBC,EAAa,QAAS,2BAA4B,EAClDC,EAAU,QAAS,yBAA0B,EAC7CC,EAAO,IAKPC,EACAC,EAAMJ,EAAYD,EAAM,UAAW,aAAc,CAAE,EAClDE,EAASG,CAAI,EACjBD,EAASD,EAETC,EAASC,EAMV,OAAO,QAAUD",
6
+ "names": ["require_base", "__commonJSMin", "exports", "module", "dpttrf", "N", "D", "strideD", "offsetD", "E", "strideE", "offsetE", "id", "ie", "v", "i", "require_dpttrf", "__commonJSMin", "exports", "module", "format", "base", "dpttrf", "N", "D", "E", "require_ndarray", "__commonJSMin", "exports", "module", "format", "base", "dpttrf", "N", "D", "strideD", "offsetD", "E", "strideE", "offsetE", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dpttrf", "ndarray", "join", "tryRequire", "isError", "main", "dpttrf", "tmp"]
7
+ }
@@ -0,0 +1,116 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ /**
22
+ * Status code.
23
+ *
24
+ * ## Notes
25
+ *
26
+ * The status code indicates the following conditions:
27
+ *
28
+ * - if equal to zero, then the factorization was successful.
29
+ * - if less than zero, then the k-th argument had an illegal value, where `k = -StatusCode`.
30
+ * - if greater than zero, then the leading principal minor of order `k` is not positive, where `k = StatusCode`. If `k < N`, then the factorization could not be completed. If `k = N`, then the factorization was completed, but `D(N) <= 0`, meaning that the matrix `A` is not positive definite.
31
+ */
32
+ type StatusCode = number;
33
+
34
+ /**
35
+ * Interface describing `dpttrf`.
36
+ */
37
+ interface Routine {
38
+ /**
39
+ * Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.
40
+ *
41
+ * @param N - order of matrix `A`
42
+ * @param D - the `N` diagonal elements of `A`
43
+ * @param E - the `N-1` subdiagonal elements of `A`
44
+ * @returns status code
45
+ *
46
+ * @example
47
+ * var Float64Array = require( '@stdlib/array-float64' );
48
+ *
49
+ * var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
50
+ * var E = new Float64Array( [ 1.0, 2.0 ] );
51
+ *
52
+ * dpttrf( 3, D, E );
53
+ * // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
54
+ * // E => <Float64Array>[ 0.25, ~0.4210 ]
55
+ */
56
+ ( N: number, D: Float64Array, E: Float64Array ): StatusCode;
57
+
58
+ /**
59
+ * Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A` using alternative indexing semantics.
60
+ *
61
+ * @param N - order of matrix `A`
62
+ * @param D - the `N` diagonal elements of `A`
63
+ * @param strideD - stride length for `D`
64
+ * @param offsetD - starting index of `D`
65
+ * @param E - the `N-1` subdiagonal elements of `A`
66
+ * @param strideE - stride length for `E`
67
+ * @param offsetE - starting index of `E`
68
+ * @returns status code
69
+ *
70
+ * @example
71
+ * var Float64Array = require( '@stdlib/array-float64' );
72
+ *
73
+ * var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
74
+ * var E = new Float64Array( [ 1.0, 2.0 ] );
75
+ *
76
+ * dpttrf.ndarray( 3, D, 1, 0, E, 1, 0 );
77
+ * // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
78
+ * // E => <Float64Array>[ 0.25, ~0.4210 ]
79
+ */
80
+ ndarray( N: number, D: Float64Array, strideD: number, offsetD: number, E: Float64Array, strideE: number, offsetE: number ): StatusCode;
81
+ }
82
+
83
+ /**
84
+ * Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.
85
+ *
86
+ * @param N - order of matrix `A`
87
+ * @param D - the `N` diagonal elements of `A`
88
+ * @param E - the `N-1` subdiagonal elements of `A`
89
+ * @returns status code
90
+ *
91
+ * @example
92
+ * var Float64Array = require( '@stdlib/array-float64' );
93
+ *
94
+ * var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
95
+ * var E = new Float64Array( [ 1.0, 2.0 ] );
96
+ *
97
+ * dpttrf( 3, D, E );
98
+ * // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
99
+ * // E => <Float64Array>[ 0.25, ~0.4210 ]
100
+ *
101
+ * @example
102
+ * var Float64Array = require( '@stdlib/array-float64' );
103
+ *
104
+ * var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
105
+ * var E = new Float64Array( [ 1.0, 2.0 ] );
106
+ *
107
+ * dpttrf.ndarray( 3, D, 1, 0, E, 1, 0 );
108
+ * // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
109
+ * // E => <Float64Array>[ 0.25, ~0.4210 ]
110
+ */
111
+ declare var dpttrf: Routine;
112
+
113
+
114
+ // EXPORTS //
115
+
116
+ export = dpttrf;
package/lib/base.js ADDED
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ 'use strict';
20
+
21
+ // MAIN //
22
+
23
+ /**
24
+ * Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.
25
+ *
26
+ * @private
27
+ * @param {NonNegativeInteger} N - order of matrix `A`
28
+ * @param {Float64Array} D - the `N` diagonal elements of `A`
29
+ * @param {integer} strideD - stride length for `D`
30
+ * @param {NonNegativeInteger} offsetD - starting index of `D`
31
+ * @param {Float64Array} E - the `N-1` subdiagonal elements of `A`
32
+ * @param {integer} strideE - stride length for `E`
33
+ * @param {NonNegativeInteger} offsetE - starting index of `E`
34
+ * @returns {integer} status code
35
+ *
36
+ * @example
37
+ * var Float64Array = require( '@stdlib/array-float64' );
38
+ *
39
+ * var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
40
+ * var E = new Float64Array( [ 1.0, 2.0 ] );
41
+ *
42
+ * dpttrf( 3, D, 1, 0, E, 1, 0 );
43
+ * // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
44
+ * // E => <Float64Array>[ 0.25, ~0.4210 ]
45
+ */
46
+ function dpttrf( N, D, strideD, offsetD, E, strideE, offsetE ) {
47
+ var id;
48
+ var ie;
49
+ var v;
50
+ var i;
51
+
52
+ if ( N === 0 ) {
53
+ return 0;
54
+ }
55
+ ie = offsetE;
56
+ id = offsetD;
57
+
58
+ // Compute the `L * D * L^T` factorization of `A`...
59
+ for ( i = 0; i < N-1; i++ ) {
60
+ // If `D[k] <= 0`, then the matrix is not positive definite...
61
+ if ( D[ id ] <= 0.0 ) {
62
+ return i+1;
63
+ }
64
+ // Solve for E[k] and D[k+1]...
65
+ v = E[ ie ];
66
+ E[ ie ] = v / D[ id ];
67
+
68
+ id += strideD;
69
+ D[ id ] -= E[ ie ] * v;
70
+
71
+ ie += strideE;
72
+ }
73
+ // Check `D[k]` for positive definiteness...
74
+ if ( D[ id ] <= 0.0 ) {
75
+ return N;
76
+ }
77
+ return 0;
78
+ }
79
+
80
+
81
+ // EXPORTS //
82
+
83
+ module.exports = dpttrf;
package/lib/dpttrf.js ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ 'use strict';
20
+
21
+ // MODULES //
22
+
23
+ var format = require( '@stdlib/string-format' );
24
+ var base = require( './base.js' );
25
+
26
+
27
+ // MAIN //
28
+
29
+ /**
30
+ * Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.
31
+ *
32
+ * @param {NonNegativeInteger} N - order of matrix `A`
33
+ * @param {Float64Array} D - the `N` diagonal elements of `A`
34
+ * @param {Float64Array} E - the `N-1` subdiagonal elements of `A`
35
+ * @throws {RangeError} first argument must be a nonnegative integer
36
+ * @returns {integer} status code
37
+ *
38
+ * @example
39
+ * var Float64Array = require( '@stdlib/array-float64' );
40
+ *
41
+ * var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
42
+ * var E = new Float64Array( [ 1.0, 2.0 ] );
43
+ *
44
+ * dpttrf( 3, D, E );
45
+ * // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
46
+ * // E => <Float64Array>[ 0.25, ~0.4210 ]
47
+ */
48
+ function dpttrf( N, D, E ) {
49
+ if ( N < 0 ) {
50
+ throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) );
51
+ }
52
+ return base( N, D, 1, 0, E, 1, 0 );
53
+ }
54
+
55
+
56
+ // EXPORTS //
57
+
58
+ module.exports = dpttrf;
package/lib/index.js ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ 'use strict';
20
+
21
+ /**
22
+ * LAPACK routine to compute the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.
23
+ *
24
+ * @module @stdlib/lapack-base-dpttrf
25
+ *
26
+ * @example
27
+ * var Float64Array = require( '@stdlib/array-float64' );
28
+ * var dpttrf = require( '@stdlib/lapack-base-dpttrf' );
29
+ *
30
+ * var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
31
+ * var E = new Float64Array( [ 1.0, 2.0 ] );
32
+ *
33
+ * dpttrf( 3, D, E );
34
+ * // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
35
+ * // E => <Float64Array>[ 0.25, ~0.4210 ]
36
+ *
37
+ * @example
38
+ * var Float64Array = require( '@stdlib/array-float64' );
39
+ * var dpttrf = require( '@stdlib/lapack-base-dpttrf' );
40
+ *
41
+ * var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
42
+ * var E = new Float64Array( [ 1.0, 2.0 ] );
43
+ *
44
+ * dpttrf.ndarray( 3, D, 1, 0, E, 1, 0 );
45
+ * // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
46
+ * // E => <Float64Array>[ 0.25, ~0.4210 ]
47
+ */
48
+
49
+ // MODULES //
50
+
51
+ var join = require( 'path' ).join;
52
+ var tryRequire = require( '@stdlib/utils-try-require' );
53
+ var isError = require( '@stdlib/assert-is-error' );
54
+ var main = require( './main.js' );
55
+
56
+
57
+ // MAIN //
58
+
59
+ var dpttrf;
60
+ var tmp = tryRequire( join( __dirname, './native.js' ) );
61
+ if ( isError( tmp ) ) {
62
+ dpttrf = main;
63
+ } else {
64
+ dpttrf = tmp;
65
+ }
66
+
67
+
68
+ // EXPORTS //
69
+
70
+ module.exports = dpttrf;
package/lib/main.js ADDED
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ 'use strict';
20
+
21
+ // MODULES //
22
+
23
+ var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
24
+ var dpttrf = require( './dpttrf.js' );
25
+ var ndarray = require( './ndarray.js' );
26
+
27
+
28
+ // MAIN //
29
+
30
+ setReadOnly( dpttrf, 'ndarray', ndarray );
31
+
32
+
33
+ // EXPORTS //
34
+
35
+ module.exports = dpttrf;
package/lib/ndarray.js ADDED
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ 'use strict';
20
+
21
+ // MODULES //
22
+
23
+ var format = require( '@stdlib/string-format' );
24
+ var base = require( './base.js' );
25
+
26
+
27
+ // MAIN //
28
+
29
+ /**
30
+ * Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A` using alternative indexing semantics.
31
+ *
32
+ * @param {NonNegativeInteger} N - order of matrix `A`
33
+ * @param {Float64Array} D - the `N` diagonal elements of `A`
34
+ * @param {integer} strideD - stride length for `D`
35
+ * @param {NonNegativeInteger} offsetD - starting index of `D`
36
+ * @param {Float64Array} E - the `N-1` subdiagonal elements of `A`
37
+ * @param {integer} strideE - stride length for `E`
38
+ * @param {NonNegativeInteger} offsetE - starting index of `E`
39
+ * @throws {RangeError} first argument must be a nonnegative integer
40
+ * @returns {integer} status code
41
+ *
42
+ * @example
43
+ * var Float64Array = require( '@stdlib/array-float64' );
44
+ *
45
+ * var D = new Float64Array( [ 4.0, 5.0, 6.0 ] );
46
+ * var E = new Float64Array( [ 1.0, 2.0 ] );
47
+ *
48
+ * dpttrf( 3, D, 1, 0, E, 1, 0 );
49
+ * // D => <Float64Array>[ 4, 4.75, ~5.15789 ]
50
+ * // E => <Float64Array>[ 0.25, ~0.4210 ]
51
+ */
52
+ function dpttrf( N, D, strideD, offsetD, E, strideE, offsetE ) {
53
+ if ( N < 0 ) {
54
+ throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) );
55
+ }
56
+ return base( N, D, strideD, offsetD, E, strideE, offsetE );
57
+ }
58
+
59
+
60
+ // EXPORTS //
61
+
62
+ module.exports = dpttrf;
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@stdlib/lapack-base-dpttrf",
3
+ "version": "0.1.0",
4
+ "description": "Compute the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "The Stdlib Authors",
8
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9
+ },
10
+ "contributors": [
11
+ {
12
+ "name": "The Stdlib Authors",
13
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14
+ }
15
+ ],
16
+ "main": "./lib",
17
+ "directories": {
18
+ "doc": "./docs",
19
+ "lib": "./lib",
20
+ "dist": "./dist"
21
+ },
22
+ "types": "./docs/types",
23
+ "scripts": {},
24
+ "homepage": "https://stdlib.io",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git://github.com/stdlib-js/lapack-base-dpttrf.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/stdlib-js/stdlib/issues"
31
+ },
32
+ "dependencies": {
33
+ "@stdlib/assert-is-error": "^0.2.2",
34
+ "@stdlib/string-format": "^0.2.2",
35
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
36
+ "@stdlib/utils-try-require": "^0.2.2",
37
+ "@stdlib/error-tools-fmtprodmsg": "^0.2.2"
38
+ },
39
+ "devDependencies": {},
40
+ "engines": {
41
+ "node": ">=0.10.0",
42
+ "npm": ">2.7.0"
43
+ },
44
+ "os": [
45
+ "aix",
46
+ "darwin",
47
+ "freebsd",
48
+ "linux",
49
+ "macos",
50
+ "openbsd",
51
+ "sunos",
52
+ "win32",
53
+ "windows"
54
+ ],
55
+ "keywords": [
56
+ "stdlib",
57
+ "stdmath",
58
+ "mathematics",
59
+ "math",
60
+ "lapack",
61
+ "dpttrf",
62
+ "cholesky",
63
+ "factorization",
64
+ "linear",
65
+ "algebra",
66
+ "subroutines",
67
+ "array",
68
+ "ndarray",
69
+ "float64",
70
+ "double",
71
+ "float64array"
72
+ ],
73
+ "funding": {
74
+ "type": "opencollective",
75
+ "url": "https://opencollective.com/stdlib"
76
+ }
77
+ }