npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@stdlib/lapack-base-dlarf1f

v0.1.1

Published

LAPACK routine to apply a real elementary reflector `H = I - tau * v * v^T` to a real M by N matrix `C`.

Downloads

205

Readme

dlarf1f

NPM version Build Status Coverage Status

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.

Installation

npm install @stdlib/lapack-base-dlarf1f

Usage

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.

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 <Float64Array>[ -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25,  0.25, -0.75 ]

The function has the following parameters:

  • order: storage layout.
  • side: specifies the side of multiplication with C.
  • M: number of rows in C.
  • N: number of columns in C.
  • V: the vector v as a Float64Array.
  • strideV: stride length for V. If strideV is negative, the elements of V are accessed in reverse order.
  • tau: scalar constant.
  • C: input matrix stored in linear memory as a Float64Array.
  • LDC: stride of the first dimension of C (a.k.a., leading dimension of the matrix C).
  • work: workspace 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,

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 <Float64Array>[ ~-3.80, -8.6, ~-13.4, ~0.56, 1.92, ~3.28, ~1.08, ~1.56, ~2.04, ~1.60, ~1.20, ~0.80 ]

To perform strided access over V, provide an abs(strideV) value greater than one. For example, to access every other element in V,

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 <Float64Array>[ -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25,  0.25, -0.75 ]

Note that indexing is relative to the first index. To introduce an offset, use typed array views.

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 => <Float64Array>[ 0.0, -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25,  0.25, -0.75 ]

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.

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 <Float64Array>[ -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25,  0.25, -0.75 ]

The function has the following additional parameters:

  • side: specifies the side of multiplication with C.
  • M: number of rows in C.
  • N: number of columns in C.
  • V: the vector v as a Float64Array.
  • sv: stride length for V.
  • ov: starting index for V.
  • tau: scalar constant.
  • C: input matrix as a Float64Array.
  • sc1: stride of the first dimension of C.
  • sc2: stride of the second dimension of C.
  • oc: starting index for C.
  • work: workspace array as a Float64Array.
  • sw: stride length for work.
  • ow: starting index for work.

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 views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example,

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 => <Float64Array>[ 0.0, 0.0, 0.0, 0.0, -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25,  0.25, -0.75 ]

Notes

Examples

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 APIs

Usage

TODO

TODO

TODO.

TODO

TODO

TODO

Examples

TODO

Notice

This package is part of 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, see the main project repository.

Community

Chat


License

See LICENSE.

Copyright

Copyright © 2016-2026. The Stdlib Authors.