4.16.124 • Published 10 months ago

@womorg/est-suscipit-quisquam v4.16.124

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Typed Arrays

NPM version Build Status Coverage Status

Create a typed array.

Installation

npm install @womorg/est-suscipit-quisquam

Alternatively,

  • To load the package in a website via a script tag without installation and bundlers, use the ES Module available on the esm branch (see README).
  • If you are using Deno, visit the deno branch (see README for usage intructions).
  • For use in Observable, or in browser/node environments, use the Universal Module Definition (UMD) build available on the umd branch (see README).

The branches.md file summarizes the available branches and displays a diagram illustrating their relationships.

To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.

Usage

var typedarray = require( '@womorg/est-suscipit-quisquam' );

typedarray( [dtype] )

Creates a typed array having a specified data type dtype.

var arr = typedarray();
// returns <Float64Array>

The function recognizes the following data types:

  • float64: double-precision floating-point numbers (IEEE 754)
  • float32: single-precision floating-point numbers (IEEE 754)
  • complex128: double-precision complex floating-point numbers
  • complex64: single-precision complex floating-point numbers
  • int32: 32-bit two's complement signed integers
  • uint32: 32-bit unsigned integers
  • int16: 16-bit two's complement signed integers
  • uint16: 16-bit unsigned integers
  • int8: 8-bit two's complement signed integers
  • uint8: 8-bit unsigned integers
  • uint8c: 8-bit unsigned integers clamped to 0-255

By default, the output typed array data type is float64. To specify an alternative data type, provide a dtype argument.

var arr = typedarray( 'int32' );
// returns <Int32Array>

typedarray( length[, dtype] )

Returns a typed array having a specified length.

var arr1 = typedarray( 5 );
// returns <Float64Array>[ 0.0, 0.0, 0.0, 0.0, 0.0 ]

var arr2 = typedarray( 5, 'uint8' );
// returns <Uint8Array>[ 0, 0, 0, 0, 0 ]

typedarray( typedarray[, dtype] )

Creates a typed array from another typed array.

var arr1 = typedarray( [ 5.0, -3.0, 2.0 ] );
// returns <Float64Array>[ 5.0, -3.0, 2.0 ]

var arr2 = typedarray( arr1 );
// returns <Float64Array>[ 5.0, -3.0, 2.0 ]

var arr3 = typedarray( arr1, 'int32' );
// returns <Int32Array>[ 5, -3, 2 ]

typedarray( obj[, dtype] )

Creates a typed array from an array-like object or iterable.

var arr1 = typedarray( [ 0.5, 0.5, 0.5 ] );
// returns <Float64Array>[ 0.5, 0.5, 0.5 ]

var arr2 = typedarray( [ 0.5, 0.5, 0.5 ], 'float32' );
// returns <Float32Array>[ 0.5, 0.5, 0.5 ]

If dtype is complex number data type and an array-like object contains interleaved real and imaginary components, the array-like object must have a length which is a multiple of two.

typedarray( buffer[, byteOffset[, length]][, dtype] )

Returns a typed array view of an ArrayBuffer.

var ArrayBuffer = require( '@stdlib/array-buffer' );
var buf = new ArrayBuffer( 32 );

var arr1 = typedarray( buf );
// returns <Float64Array>[ 0.0, 0.0, 0.0, 0.0 ]

var arr2 = typedarray( buf, 'float32' );
// returns <Float32Array>[ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]

var arr3 = typedarray( buf, 16 );
// returns <Float64Array>[ 0.0, 0.0 ]

var arr4 = typedarray( buf, 16, 'float32' );
// returns <Float32Array>[ 0.0, 0.0, 0.0, 0.0 ]

var arr5 = typedarray( buf, 16, 1 );
// returns <Float64Array>[ 0.0 ]

var arr6 = typedarray( buf, 10, 4, 'int16' );
// returns <Int16Array>[ 0, 0, 0, 0 ]

Notes

  • When providing a complex number array, if dtype is unspecified or the specified data type is not a complex number data type, the returned array contains interleaved real and imaginary components.

Examples

var randu = require( '@stdlib/random-base-randu' );
var typedarray = require( '@womorg/est-suscipit-quisquam' );

var arr = typedarray( 100, 'float64' );

var i;
for ( i = 0; i < arr.length; i++ ) {
    arr[ i ] = randu() * 100.0;
}
console.log( arr );

See Also


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-2024. The Stdlib Authors.

typeofbyteOffsetwaftoSortedpackagereact-hooksautoprefixercallbindrequirejestperformancepackagesstreams2String.prototype.trimtaskargparseBigInt64Arrayphonepackage.jsonwatchingES2018awesomesauceparseTypeScripteventsarraysrestgetdebuggergetintrinsicsuperagentsettingsendpointlinkownlesscssECMAScript 3objpreprocessorsnscolumniamgetoptObject.issharedmakespecforEachtouchterminalmimejasminestringifyenumerablewraplimitedroute53buffersRxJSgroupyamlparentRxlookcrypthasArray.prototype.findLastIndexregular expressionchailintcommanderbytecloudformationECMAScript 2018IteratorvalueinspectfullwidthidentifierscomparereuseES2019descriptoromitwebreadablevisualiterationuuidArray.prototype.includeses2018regularcall-boundfastcloneprotoxtermhigher-ordertapworkflowmatchfasti18niterateshamRegExp.prototype.flagsremovecode pointsassignutilitiestimetrimStarteveryES2016open__proto__negative zeroES7loggings3fseventsloadinghooksglobwidthframeworkformattingtrimdeepmake dirfilterworkspace:*awsauthenvironmentsreducerextensionsliceES6liveconcat_.extendmixinsregexbluebirdtddsafeInt8ArrayStreamlogwatchjsdiffairbnbrobustcharacterszodinterruptseast-asian-widthupfast-deep-copyutil.inspectroutingdatabundlingassertvalidationArray.prototype.flatMapconnecterror-handlingrangeerrorcopyUnderscorepruneJSON-SchematesteventEmittersymlinksinvariantbddjsfluxdatedatastructureassertionfastifydirectory0Function.prototype.namePushflatMapcloudsearchprogressauthenticationSymbol.toStringTagtestertoolsoptimistqueryTypedArrayelbbrowserlistMicrosoftwaithardlinkscolourfilehasOwnPropertyfindupstyled-componentsequalreal-timeReflect.getPrototypeOfless.jsthroates6colorjsonshellcheckhasOwnrandomproxyartinternal slotES2023-0tostringtages7pipelazyfixed-widthArray.prototype.flataccessibilitystreamsmapprototypecall-bindECMAScript 2021syntaxgetterhookformquotettyURLArrayBuffer.prototype.sliceformses8persistentbufferglobalfolderRFC-6455spinnersmochacommand-linewhichvaluespropstoragegatewayrmdiroutputenvmodulesxhrflattenES2021corsFloat32ArrayjapaneseoptimizerCSScjkArrayBufferfigletrecursivecircularinputTypeBoxmimetypeskeyswgetentrieslessfind-upjwtES2022look-upcompile lessnamesvarsidextraerrorbundleroptionagentcharacterdomansilistenersloggercore-jsfindLastemitarktypeextendESnextreducenested cssthrottlearraybufferstylesimportkinesistypedarrayschemagenericstoolkitassertschannelhelpersECMAScript 6postcssshebangeslint-pluginmergediffprocesses-abstractdebugeslintplugincodessortedUint8ArrayECMAScript 7preserve-symlinksbeanstalkBigUint64ArrayES3CSSStyleDeclarationec2stylinges-shim APImapreduceutillrureactemrkeyratecss-in-jsqueueMicrotasktrimLeftclass-validatorECMAScript 2020argsString.prototype.matchAllstructuredClonejsdomlanguagesymbolinferencevestlinewrapdescriptionprefixreplaylastclirapidjoirmscheme-validationajaxenderastbreakwhatwgfast-clonesameValueZerohotregexpnamebootstrap cssparentsSymbolstarterpropertiesfindLastIndexasciiserializertelephoneinstalleres2015MapwalkingmacosdefineURLSearchParamsArray.prototype.flattenfunctionaleventDispatchersetImmediateappspinnerhas-owntypedarraysreadReactiveXpositivesignalsestreelimitsomeslotbindjsxfromcollection.es6redactObject.keyseslintconfigES8$.extendtakemonorepoajvvariablesES2020accessorjavascriptdataviewpathcachetrimRightescapetestingrouterdeleteparserargvelasticacheInt16Arrayeslintredux-toolkitInt32ArrayponyfillnodejsUint16ArrayjshintgetOwnPropertyDescriptorcompilerrdsbcryptJSON@@toStringTagcorecollectionebstoobjectprotocol-buffersstylecontainscryptocomputed-typesfssinatrasuperstructcss lessqueuemkdirfindequalitytypeObject.getPrototypeOfimmutablestringifierpluginreadablestreamimmer.enves-shimsexpressiones2017onceconsumeconfigwatchFileparsingESES2017formatdescriptors
4.15.110

10 months ago

4.15.111

10 months ago

4.14.99

11 months ago

4.15.109

11 months ago

4.16.120

10 months ago

4.16.121

10 months ago

4.16.122

10 months ago

4.16.123

10 months ago

4.16.124

10 months ago

4.16.117

10 months ago

4.14.104

11 months ago

4.16.118

10 months ago

4.14.105

11 months ago

4.16.119

10 months ago

4.14.106

11 months ago

4.14.107

11 months ago

4.14.100

11 months ago

4.14.101

11 months ago

4.14.102

11 months ago

4.14.103

11 months ago

4.16.111

10 months ago

4.16.112

10 months ago

4.16.113

10 months ago

4.14.108

11 months ago

4.16.114

10 months ago

4.14.109

11 months ago

4.16.115

10 months ago

4.16.116

10 months ago

4.14.98

11 months ago

4.13.97

11 months ago

4.13.98

11 months ago

4.13.95

11 months ago

4.13.96

11 months ago

4.13.93

11 months ago

4.13.94

11 months ago

4.12.91

11 months ago

4.12.90

11 months ago

4.12.93

11 months ago

4.12.92

11 months ago

4.12.88

11 months ago

4.12.87

11 months ago

4.12.89

11 months ago

4.12.86

11 months ago

4.12.85

11 months ago

4.12.84

11 months ago

4.12.83

11 months ago

4.12.82

12 months ago

4.11.82

12 months ago

4.11.81

12 months ago

4.11.80

12 months ago

4.9.79

12 months ago

4.9.78

12 months ago

4.10.80

12 months ago

4.10.79

12 months ago

4.8.76

12 months ago

4.8.78

12 months ago

4.8.77

12 months ago

4.8.74

12 months ago

4.8.73

12 months ago

4.8.75

12 months ago

4.8.69

12 months ago

4.8.70

12 months ago

4.8.72

12 months ago

4.8.71

12 months ago

4.8.61

1 year ago

4.8.60

1 year ago

4.8.63

1 year ago

4.7.52

1 year ago

4.6.40

1 year ago

4.8.62

1 year ago

4.7.53

1 year ago

4.6.41

1 year ago

4.8.65

1 year ago

4.7.50

1 year ago

4.8.64

1 year ago

4.7.51

1 year ago

4.8.67

12 months ago

4.6.44

1 year ago

4.8.66

1 year ago

4.6.45

1 year ago

4.7.54

1 year ago

4.6.42

1 year ago

4.8.68

12 months ago

4.7.55

1 year ago

4.6.43

1 year ago

4.5.39

1 year ago

4.8.56

1 year ago

4.7.45

1 year ago

4.8.55

1 year ago

4.7.46

1 year ago

4.8.58

1 year ago

4.8.57

1 year ago

4.7.49

1 year ago

4.8.59

1 year ago

4.7.47

1 year ago

4.7.48

1 year ago

4.6.39

1 year ago

3.5.39

1 year ago

3.5.38

1 year ago

3.5.37

1 year ago

2.5.36

1 year ago

2.5.37

1 year ago

2.5.35

1 year ago

2.4.35

1 year ago

2.4.32

1 year ago

2.4.31

1 year ago

2.4.34

1 year ago

2.4.33

1 year ago

2.3.29

1 year ago

2.3.31

1 year ago

2.3.30

1 year ago

1.3.18

1 year ago

1.3.19

1 year ago

1.3.20

1 year ago

1.3.21

1 year ago

1.3.24

1 year ago

1.3.25

1 year ago

1.3.22

1 year ago

1.3.23

1 year ago

1.3.28

1 year ago

1.3.29

1 year ago

1.3.26

1 year ago

1.3.27

1 year ago

1.3.17

1 year ago

1.3.16

1 year ago

1.3.13

1 year ago

1.3.14

1 year ago

1.3.12

1 year ago

1.3.15

1 year ago

1.3.11

1 year ago

1.3.10

1 year ago

1.2.10

1 year ago

1.2.9

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago