LAPACK routine to apply a real elementary reflector `H = I - tau * v * v^T` to a real M by N matrix `C`.
npm install @stdlib/lapack-base-dlarf1fWe 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. 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. 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. To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
About stdlib...
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url]
> Apply a real elementary reflector H = I - tau v v^T to a real M by N matrix C.
A Householder transformation (or an elementary reflector) is a linear transformation that describes a reflection about a plane or a hyperplane containing the origin.
``bash`
npm install @stdlib/lapack-base-dlarf1f
`javascript`
var dlarf1f = require( '@stdlib/lapack-base-dlarf1f' );
#### dlarf1f( order, side, M, N, V, strideV, tau, C, LDC, work )
Applies a real elementary reflector H = I - tau v v^T to a real M by N matrix C.
`javascript
var Float64Array = require( '@stdlib/array-float64' );
var C = new Float64Array( [ 1.0, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0 ] );
var V = new Float64Array( [ 0.5, 0.5, 0.5, 0.5 ] );
var work = new Float64Array( 3 );
var out = dlarf1f( 'row-major', 'left', 4, 3, V, 1, 1.0, C, 3, work );
// returns
`
The function has the following parameters:
- order: storage layout.
- side: specifies the side of multiplication with C.C
- M: number of rows in .C
- N: number of columns in .v
- V: the vector as a [Float64Array][mdn-float64array].V
- strideV: stride length for . If strideV is negative, the elements of V are accessed in reverse order.Float64Array
- tau: scalar constant.
- C: input matrix stored in linear memory as a [][mdn-float64array].C
- LDC: stride of the first dimension of (a.k.a., leading dimension of the matrix C).Float64Array
- work: workspace [][mdn-float64array].
When side is 'left',
- work should have N indexed elements.V
- should have 1 + (M-1) * abs(strideV) indexed elements.C
- is overwritten by H * C.
When side is 'right',
- work should have M indexed elements.V
- should have 1 + (N-1) * abs(strideV) indexed elements.C
- is overwritten by C * H.
The sign of the increment parameter strideV determines the order in which elements of V are accessed. For example, to access elements in reverse order,
`javascript
var Float64Array = require( '@stdlib/array-float64' );
var C = new Float64Array( [ 1.0, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0 ] );
var V = new Float64Array( [ 0.5, 0.4, 0.3, 0.2 ] );
var work = new Float64Array( 3 );
var out = dlarf1f( 'row-major', 'left', 4, 3, V, -1, 1.0, C, 3, work );
// returns
`
To perform strided access over V, provide an abs(strideV) value greater than one. For example, to access every other element in V,
`javascript
var Float64Array = require( '@stdlib/array-float64' );
var C = new Float64Array( [ 1.0, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0 ] );
var V = new Float64Array( [ 0.5, 999, 0.5, 999, 0.5, 999, 0.5 ] );
var work = new Float64Array( 3 );
var out = dlarf1f( 'row-major', 'left', 4, 3, V, 2, 1.0, C, 3, work );
// returns
`
Note that indexing is relative to the first index. To introduce an offset, use [typed array][mdn-typed-array] views.
`javascript
var Float64Array = require( '@stdlib/array-float64' );
// Initial arrays...
var C0 = new Float64Array( [ 0.0, 1.0, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0 ] );
var V0 = new Float64Array( [ 0.0, 0.5, 0.5, 0.5, 0.5 ] );
var work0 = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] );
// Create offset views...
var C1 = new Float64Array( C0.buffer, C0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var V1 = new Float64Array( V0.buffer, V0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var work1 = new Float64Array( work0.buffer, work0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var our = dlarf1f( 'row-major', 'left', 4, 3, V1, 1, 1.0, C1, 3, work1 );
// C0 =>
`
#### dlarf1f.ndarray( side, M, N, V, sv, ov, tau, C, sc1, sc2, oc, work, sw, ow )
Applies a real elementary reflector H = I - tau v v^T to a real M by N matrix C using alternative indexing semantics.
`javascript
var Float64Array = require( '@stdlib/array-float64' );
var C = new Float64Array( [ 1.0, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0 ] );
var V = new Float64Array( [ 0.5, 0.5, 0.5, 0.5 ] );
var work = new Float64Array( 3 );
var out = dlarf1f.ndarray( 'left', 4, 3, V, 1, 0, 1.0, C, 3, 1, 0, work, 1, 0 );
// returns
`
The function has the following additional parameters:
- side: specifies the side of multiplication with C.C
- M: number of rows in .C
- N: number of columns in .v
- V: the vector as a [Float64Array][mdn-float64array].V
- sv: stride length for .V
- ov: starting index for .Float64Array
- tau: scalar constant.
- C: input matrix as a [][mdn-float64array].C
- sc1: stride of the first dimension of .C
- sc2: stride of the second dimension of .C
- oc: starting index for .Float64Array
- work: workspace array as a [][mdn-float64array].work
- sw: stride length for .work
- ow: starting index for .
When side is 'left',
- work should have N indexed elements.V
- should have 1 + (M-1) * abs(sv) indexed elements.C
- is overwritten by H * C.
When side is 'right',
- work should have M indexed elements.V
- should have 1 + (N-1) * abs(sv) indexed elements.C
- is overwritten by C * H.
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,
`javascript
var Float64Array = require( '@stdlib/array-float64' );
var C = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0 ] );
var V = new Float64Array( [ 0.0, 0.0, 0.5, 0.5, 0.5, 0.5 ] );
var work = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] );
var out = dlarf1f.ndarray( 'left', 4, 3, V, 1, 2, 1.0, C, 3, 1, 4, work, 1, 0 );
// C =>
`
- dlarf1f() corresponds to the [LAPACK][LAPACK] function [dlarf1f][lapack-dlarf1f].
`javascript
var Float64Array = require( '@stdlib/array-float64' );
var ndarray2array = require( '@stdlib/ndarray-base-to-array' );
var shape2strides = require( '@stdlib/ndarray-base-shape2strides' );
var dlarf1f = require( '@stdlib/lapack-base-dlarf1f' );
// Specify matrix meta data:
var shape = [ 4, 3 ];
var order = 'row-major';
var strides = shape2strides( shape, order );
// Create a matrix stored in linear memory:
var C = new Float64Array( [ 1.0, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0 ] );
console.log( ndarray2array( C, shape, strides, 0, order ) );
// Define the vector v and a workspace array:
var V = new Float64Array( [ 0.5, 0.5, 0.5, 0.5 ] );
var work = new Float64Array( 3 );
// Apply the elementary reflector:
dlarf1f( order, 'left', shape[ 0 ], shape[ 1 ], V, 1, 1.0, C, strides[ 0 ], work );
console.log( ndarray2array( C, shape, strides, 0, order ) );
`
*
`c`
TODO
#### TODO
TODO.
`c`
TODO
TODO
`c`
TODO
`c`
TODO
*
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.
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].
#### Community
[![Chat][chat-image]][chat-url]
---
See [LICENSE][stdlib-license].
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
[npm-image]: http://img.shields.io/npm/v/@stdlib/lapack-base-dlarf1f.svg
[npm-url]: https://npmjs.org/package/@stdlib/lapack-base-dlarf1f
[test-image]: https://github.com/stdlib-js/lapack-base-dlarf1f/actions/workflows/test.yml/badge.svg?branch=v0.1.1
[test-url]: https://github.com/stdlib-js/lapack-base-dlarf1f/actions/workflows/test.yml?query=branch:v0.1.1
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/lapack-base-dlarf1f/main.svg
[coverage-url]: https://codecov.io/github/stdlib-js/lapack-base-dlarf1f?branch=main
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
[chat-url]: https://stdlib.zulipchat.com
[stdlib]: https://github.com/stdlib-js/stdlib
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
[umd]: https://github.com/umdjs/umd
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
[deno-url]: https://github.com/stdlib-js/lapack-base-dlarf1f/tree/deno
[deno-readme]: https://github.com/stdlib-js/lapack-base-dlarf1f/blob/deno/README.md
[umd-url]: https://github.com/stdlib-js/lapack-base-dlarf1f/tree/umd
[umd-readme]: https://github.com/stdlib-js/lapack-base-dlarf1f/blob/umd/README.md
[esm-url]: https://github.com/stdlib-js/lapack-base-dlarf1f/tree/esm
[esm-readme]: https://github.com/stdlib-js/lapack-base-dlarf1f/blob/esm/README.md
[branches-url]: https://github.com/stdlib-js/lapack-base-dlarf1f/blob/main/branches.md
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/lapack-base-dlarf1f/main/LICENSE
[lapack]: https://www.netlib.org/lapack/explore-html/
[lapack-dlarf1f]: https://netlib.org/lapack/explore-html/d2/d97/group__larf_ga3b4608752c4f72758c2d297e1e7cf3f0.html#ga3b4608752c4f72758c2d297e1e7cf3f0
[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray