Skip to content

Latest commit

 

History

History
62 lines (40 loc) · 936 Bytes

one.md

File metadata and controls

62 lines (40 loc) · 936 Bytes

one

Create an array filled entirely with ones.

API

Numeric.create.one(shape)

Builds an array filled with ones.

  • Parameters:
    • shape: Target dimensions of the created array
  • Returns: Array filled with ones
  • NumPy: Covers np.ones, np.ones_like through a single Numerix method.

Examples

Vector of ones

import Numeric from '@neabyte/numerix'

const values = Numeric.create.one([3])

console.log(values)
// [1,1,1]

Matrix of ones

import Numeric from '@neabyte/numerix'

const matrix = Numeric.create.one([2, 2])

console.log(matrix)
// [[1,1],[1,1]]

Matrix of ones with three columns

import Numeric from '@neabyte/numerix'

const matrix = Numeric.create.one([2, 3])

console.log(matrix)
// [[1,1,1],[1,1,1]]

Array holding a single one

import Numeric from '@neabyte/numerix'

const values = Numeric.create.one([1])

console.log(values)
// [1]