Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

stdlib-js/blas-base-ndarray-dgemm

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About stdlib...

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.

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!

dgemm

NPM version Build Status Coverage Status

Perform the matrix-matrix operation C = alpha*op(A)*op(B) + beta*C.

Usage

import dgemm from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-base-ndarray-dgemm@deno/mod.js';

dgemm( arrays )

Performs the matrix-matrix operation C = alpha*op(A)*op(B) + beta*C, where op(X) is either op(X) = X or op(X) = X^T, alpha and beta are scalars, A, B, and C are matrices, with op(A) an M by K matrix, op(B) a K by N matrix, and C an M by N matrix.

import Float64Matrix from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-matrix-float64@deno/mod.js';
import scalar2ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-from-scalar@deno/mod.js';
import resolveEnum from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-base-transpose-operation-resolve-enum@deno/mod.js';

var A = new Float64Matrix( [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] );
var B = new Float64Matrix( [ [ 1.0, 1.0 ], [ 0.0, 1.0 ] ] );
var C = new Float64Matrix( [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] );

var transA = scalar2ndarray( resolveEnum( 'no-transpose' ), {
    'dtype': 'int32'
});
var transB = scalar2ndarray( resolveEnum( 'no-transpose' ), {
    'dtype': 'int32'
});
var alpha = scalar2ndarray( 1.0, {
    'dtype': 'float64'
});
var beta = scalar2ndarray( 1.0, {
    'dtype': 'float64'
});

var out = dgemm( [ A, B, C, transA, transB, alpha, beta ] );
// returns <ndarray>[ [ 2.0, 5.0 ], [ 6.0, 11.0 ] ]

var bool = ( out === C );
// returns true

The function has the following parameters:

  • arrays: array-like object containing the following ndarrays:

    • a two-dimensional input ndarray corresponding to A.
    • a two-dimensional input ndarray corresponding to B.
    • a two-dimensional input/output ndarray corresponding to C.
    • a zero-dimensional ndarray specifying whether A should be transposed, conjugate-transposed, or not transposed.
    • a zero-dimensional ndarray specifying whether B should be transposed, conjugate-transposed, or not transposed.
    • a zero-dimensional ndarray containing a scalar constant corresponding to alpha.
    • a zero-dimensional ndarray containing a scalar constant corresponding to beta.

Examples

import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-discrete-uniform@deno/mod.js';
import scalar2ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-from-scalar@deno/mod.js';
import resolveEnum from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-base-transpose-operation-resolve-enum@deno/mod.js';
import ndarray2array from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-to-array@deno/mod.js';
import dgemm from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-base-ndarray-dgemm@deno/mod.js';

var opts = {
    'dtype': 'float64'
};

var A = discreteUniform( [ 3, 4 ], 0, 10, opts );
var B = discreteUniform( [ 4, 2 ], 0, 10, opts );
var C = discreteUniform( [ 3, 2 ], 0, 10, opts );

var transA = scalar2ndarray( resolveEnum( 'no-transpose' ), {
    'dtype': 'int32'
});
var transB = scalar2ndarray( resolveEnum( 'no-transpose' ), {
    'dtype': 'int32'
});
var alpha = scalar2ndarray( 1.0, opts );
var beta = scalar2ndarray( 1.0, opts );

var out = dgemm( [ A, B, C, transA, transB, alpha, beta ] );
console.log( ndarray2array( out ) );

Notice

This package is part of stdlib, a standard library 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.

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.