| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -186,21 +186,67 @@ console.log( x ); | |
| ### Usage | ||
|
|
||
| ```c | ||
| TODO | ||
| #include "stdlib/blas/base/dtrmv.h" | ||
| ``` | ||
|
|
||
| #### TODO | ||
| #### c_dtrmv( order, uplo, trans, diag, N, \*A, LDA, \*X, sx ) | ||
|
|
||
| TODO. | ||
| Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. | ||
|
|
||
| ```c | ||
| #include "stdlib/blas/base/shared.h" | ||
|
|
||
| const double A[] = { 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 }; | ||
| double x[] = { 1.0, 2.0, 3.0 }; | ||
|
|
||
| c_dtrmv( CblasRowMajor, CblasUpper, CblasNoTrans, CblasUnit, 3, A, 3, x, 1 ); | ||
| ``` | ||
|
|
||
| The function accepts the following arguments: | ||
|
|
||
| - **order**: `[in] CBLAS_LAYOUT` storage layout. | ||
| - **uplo**: `[in] CBLAS_UPLO` specifies whether `A` is an upper or lower triangular matrix. | ||
| - **trans**: `[in] CBLAS_TRANSPOSE` specifies whether `A` should be transposed, conjugate-transposed, or not transposed. | ||
| - **diag**: `[in] CBLAS_DIAG` specifies whether `A` has a unit diagonal. | ||
| - **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`. | ||
| - **A**: `[in] double*` input matrix. | ||
| - **LDA**: `[in] CBLAS_INT` stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). | ||
| - **X**: `[inout] double*` input vector. | ||
| - **sx**: `[in] CBLAS_INT` stride length for `X`. | ||
|
|
||
| ```c | ||
| TODO | ||
| void c_dtrmv( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_TRANSPOSE trans, const CBLAS_DIAG diag, const CBLAS_INT N, const double *A, const CBLAS_INT LDA, double *x, const CBLAS_INT strideX ) | ||
| ``` | ||
|
|
||
| TODO | ||
| #### c_dtrmv_ndarray( uplo, trans, diag, N, \*A, sa1, sa2, oa, \*X, sx, ox ) | ||
|
|
||
| Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x` using alternative indexing semantics, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. | ||
|
|
||
| ```c | ||
| #include "stdlib/blas/base/shared.h" | ||
|
|
||
| const double A[] = { 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 }; | ||
| double x[] = { 1.0, 2.0, 3.0 }; | ||
|
|
||
| c_dtrmv_ndarray( CblasUpper, CblasNoTrans, CblasUnit, 3, A, 3, 1, 0, x, 1, 0 ); | ||
| ``` | ||
|
|
||
| The function accepts the following arguments: | ||
|
|
||
| - **uplo**: `[in] CBLAS_UPLO` specifies whether `A` is an upper or lower triangular matrix. | ||
| - **trans**: `[in] CBLAS_TRANSPOSE` specifies whether `A` should be transposed, conjugate-transposed, or not transposed. | ||
| - **diag**: `[in] CBLAS_DIAG` specifies whether `A` has a unit diagonal. | ||
| - **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`. | ||
| - **A**: `[in] double*` input matrix. | ||
| - **strideA1**: `[in] CBLAS_INT` stride of the first dimension of `A`. | ||
| - **strideA2**: `[in] CBLAS_INT` stride of the second dimension of `A`. | ||
| - **offsetA**: `[in] CBLAS_INT` starting index for `A`. | ||
| - **X**: `[inout] double*` input vector. | ||
| - **sx**: `[in] CBLAS_INT` stride length for `X`. | ||
| - **offsetX**: `[in] CBLAS_INT` starting index for `X`. | ||
|
|
||
| ```c | ||
| TODO | ||
| void c_dtrmv_ndarray( const CBLAS_UPLO uplo, const CBLAS_TRANSPOSE trans, const CBLAS_DIAG diag, const CBLAS_INT N, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX ) | ||
| ``` | ||
|
|
||
| </section> | ||
| Expand All | @@ -222,7 +268,39 @@ TODO | |
| ### Examples | ||
|
|
||
| ```c | ||
| TODO | ||
| #include "stdlib/blas/base/dtrmv.h" | ||
| #include "stdlib/blas/base/shared.h" | ||
| #include <stdio.h> | ||
|
|
||
| int main( void ) { | ||
| // Define a 3x3 triangular matrix stored in row-major order: | ||
| const double A[ 3*3 ] = { | ||
| 1.0, 0.0, 0.0, | ||
| 2.0, 1.0, 0.0, | ||
| 3.0, 2.0, 1.0 | ||
| }; | ||
| // Define `x` vector: | ||
| double x[ 3 ] = { 1.0, 2.0, 3.0 }; | ||
|
|
||
| // Specify the number of elements along each dimension of `A`: | ||
| const int N = 3; | ||
|
|
||
| // Perform the matrix-vector operations `x = A*x`: | ||
| c_dtrmv( CblasRowMajor, CblasUpper, CblasNoTrans, CblasUnit, N, A, N, x, 1 ); | ||
|
|
||
| // Print the result: | ||
| for ( int i = 0; i < N; i++ ) { | ||
| printf( "x[ %i ] = %lf\n", i, x[ i ] ); | ||
| } | ||
|
|
||
| // Perform the matrix-vector operations `x = A*x` using alternative indexing semantics: | ||
| c_dtrmv_ndarray( CblasUpper, CblasNoTrans, CblasUnit, 3, A, 3, 1, 0, x, 1, 0 ); | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityCblasLower
Sorry, something went wrong.
All reactions
|
||
|
|
||
| // Print the result: | ||
| for ( int i = 0; i < N; i++ ) { | ||
| printf( "x[ %i ] = %lf\n", i, x[ i ] ); | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </section> | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| /** | ||
| * @license Apache-2.0 | ||
| * | ||
| * Copyright (c) 2025 The Stdlib Authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| // MODULES // | ||
|
|
||
| var resolve = require( 'path' ).resolve; | ||
| var bench = require( '@stdlib/bench' ); | ||
| var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
| var ones = require( '@stdlib/array/ones' ); | ||
| var pow = require( '@stdlib/math/base/special/pow' ); | ||
| var floor = require( '@stdlib/math/base/special/floor' ); | ||
| var tryRequire = require( '@stdlib/utils/try-require' ); | ||
| var pkg = require( './../package.json' ).name; | ||
|
|
||
|
|
||
| // VARIABLES // | ||
|
|
||
| var dtrmv = tryRequire( resolve( __dirname, './../lib/dtrmv.native.js' ) ); | ||
| var opts = { | ||
| 'skip': ( dtrmv instanceof Error ) | ||
| }; | ||
| var options = { | ||
| 'dtype': 'float64' | ||
| }; | ||
|
|
||
|
|
||
| // FUNCTIONS // | ||
|
|
||
| /** | ||
| * Creates a benchmark function. | ||
| * | ||
| * @private | ||
| * @param {PositiveInteger} N - array length | ||
| * @returns {Function} benchmark function | ||
| */ | ||
| function createBenchmark( N ) { | ||
| var x = ones( N, options.dtype ); | ||
| var A = ones( N*N, options.dtype ); | ||
| return benchmark; | ||
|
|
||
| function benchmark( b ) { | ||
| var z; | ||
| var i; | ||
|
|
||
| b.tic(); | ||
| for ( i = 0; i < b.iterations; i++ ) { | ||
| z = dtrmv( 'row-major', 'upper', 'transpose', 'non-unit', N, A, N, x, 1 ); | ||
| if ( isnan( z ) ) { | ||
| b.fail( 'should not return NaN' ); | ||
| } | ||
| } | ||
| b.toc(); | ||
| if ( isnan( z ) ) { | ||
| b.fail( 'should not return NaN' ); | ||
| } | ||
| b.pass( 'benchmark finished' ); | ||
| b.end(); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| // MAIN // | ||
|
|
||
| /** | ||
| * Main execution sequence. | ||
| * | ||
| * @private | ||
| */ | ||
| function main() { | ||
| var min; | ||
| var max; | ||
| var N; | ||
| var f; | ||
| var i; | ||
|
|
||
| min = 1; // 10^min | ||
| max = 6; // 10^max | ||
|
|
||
| for ( i = min; i <= max; i++ ) { | ||
| N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); | ||
| f = createBenchmark( N ); | ||
| bench( pkg+'::native:size='+(N*N), opts, f ); | ||
| } | ||
| } | ||
|
|
||
| main(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| /** | ||
| * @license Apache-2.0 | ||
| * | ||
| * Copyright (c) 2025 The Stdlib Authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| // MODULES // | ||
|
|
||
| var resolve = require( 'path' ).resolve; | ||
| var bench = require( '@stdlib/bench' ); | ||
| var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
| var ones = require( '@stdlib/array/ones' ); | ||
| var pow = require( '@stdlib/math/base/special/pow' ); | ||
| var floor = require( '@stdlib/math/base/special/floor' ); | ||
| var tryRequire = require( '@stdlib/utils/try-require' ); | ||
| var pkg = require( './../package.json' ).name; | ||
|
|
||
|
|
||
| // VARIABLES // | ||
|
|
||
| var dgemv = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); | ||
| var opts = { | ||
| 'skip': ( dgemv instanceof Error ) | ||
| }; | ||
| var options = { | ||
| 'dtype': 'float64' | ||
| }; | ||
|
|
||
|
|
||
| // FUNCTIONS // | ||
|
|
||
| /** | ||
| * Creates a benchmark function. | ||
| * | ||
| * @private | ||
| * @param {PositiveInteger} N - array length | ||
| * @returns {Function} benchmark function | ||
| */ | ||
| function createBenchmark( N ) { | ||
| var x = ones( N, options.dtype ); | ||
| var A = ones( N*N, options.dtype ); | ||
| return benchmark; | ||
|
|
||
| function benchmark( b ) { | ||
| var z; | ||
| var i; | ||
|
|
||
| b.tic(); | ||
| for ( i = 0; i < b.iterations; i++ ) { | ||
| z = dgemv( 'upper', 'transpose', 'non-unit', N, A, N, 1, 0, x, 1, 0 ); | ||
| if ( isnan( z ) ) { | ||
| b.fail( 'should not return NaN' ); | ||
| } | ||
| } | ||
| b.toc(); | ||
| if ( isnan( z ) ) { | ||
| b.fail( 'should not return NaN' ); | ||
| } | ||
| b.pass( 'benchmark finished' ); | ||
| b.end(); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| // MAIN // | ||
|
|
||
| /** | ||
| * Main execution sequence. | ||
| * | ||
| * @private | ||
| */ | ||
| function main() { | ||
| var min; | ||
| var max; | ||
| var N; | ||
| var f; | ||
| var i; | ||
|
|
||
| min = 1; // 10^min | ||
| max = 6; // 10^max | ||
|
|
||
| for ( i = min; i <= max; i++ ) { | ||
| N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); | ||
| f = createBenchmark( N ); | ||
| bench( pkg+'::native:ndarray:size='+(N*N), opts, f ); | ||
| } | ||
| } | ||
|
|
||
| main(); |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityCblasLower
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.