Skip to content

Latest commit

 

History

History
63 lines (41 loc) · 1.05 KB

full.md

File metadata and controls

63 lines (41 loc) · 1.05 KB

full

Create an array filled with a single repeated value.

API

Numeric.create.full(shape, value = 0)

Builds an array filled with the given value.

  • Parameters:
    • shape: Target dimensions of the created array
    • value: Value placed in every cell
  • Returns: Array filled with the given value
  • NumPy: Covers np.full, np.full_like, ndarray.fill through a single Numerix method.

Examples

Matrix filled with sevens

import Numeric from '@neabyte/numerix'

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

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

Vector filled with ones

import Numeric from '@neabyte/numerix'

const values = Numeric.create.full([3], 1)

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

Matrix filled with a fractional value

import Numeric from '@neabyte/numerix'

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

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

Default fill value

import Numeric from '@neabyte/numerix'

const values = Numeric.create.full([2])

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