GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ndarray/ndarraylike2ndarray at main · stdlib-js/ndarray

Expand file tree

/

ndarraylike2ndarray

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

ndarraylike2ndarray

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
benchmark
benchmark
 
 
docs
docs
 
 
examples
examples
 
 
lib
lib
 
 
test
test
 
 
README.md
README.md
 
 
package.json
package.json
 
 

README.md

Outline

ndarraylike2ndarray

Convert an ndarray-like object to an ndarray.

Usage

var ndarraylike2ndarray = require( '@stdlib/ndarray/ndarraylike2ndarray' );

ndarraylike2ndarray( x[, options] )

Converts an ndarray-like object to an ndarray.

var array = require( '@stdlib/ndarray/array' );

var arr = array( [ [ 1, 2 ], [ 3, 4 ] ] );
var out = ndarraylike2ndarray( arr );
// returns <ndarray>

The function supports the same options as ndarray.

Notes

  • If provided a read-only ndarray, the function returns a read-only ndarray.

Examples

var array = require( '@stdlib/ndarray/array' );
var ndarraylike2ndarray = require( '@stdlib/ndarray/ndarraylike2ndarray' );

// Create an ndarray:
var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );

// Create another ndarray sharing the same data:
var out = ndarraylike2ndarray( x );
// returns <ndarray>

// Print various properties:
console.log( 'dtype: %s', out.dtype );
console.log( 'ndims: %d', out.shape.length );
console.log( 'length: %d', out.length );
console.log( 'shape: [ %s ]', out.shape.join( ', ' ) );
console.log( 'strides: [ %s ]', out.strides.join( ', ' ) );
console.log( 'offset: %d', out.offset );
console.log( 'order: %s', out.order );

See Also

  • @stdlib/ndarray/array: multidimensional arrays.
  • @stdlib/ndarray/ctor: multidimensional array constructor.
  • @stdlib/ndarray/empty-like: create an uninitialized ndarray having the same shape and data type as a provided ndarray.
  • @stdlib/ndarray/zeros-like: create a zero-filled ndarray having the same shape and data type as a provided ndarray.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.