Swift · Quickstart

Quickstart

import NumKong 8.0.0-rc.1 · b1f866ab

import NumKong

let a: [Float32] = [1, 2, 3]
let b: [Float32] = [4, 5, 6]
let dot = a.dot(b) // widened to Float64
print(dot as Any)

API

EnumStatusWhy a call failed, one case per failing nk_status_t, which nk_status_name spells.1
NumKong.swift:319 ↗
enum Status

Values

badAllocation
unexpectedDimensions
missingGpu
deviceCodeMismatch
deviceMemoryMismatch
missingKernel
misaligned
packMismatch
missingLibrary

Conforms to

Equatable, Hashable, RawRepresentable, Sendable
nameThe C spelling, like "unexpected_dimensions".
NumKong.swift:331 ↗
var name: String { get }
StructErrorOne failed call: a status every caller can branch on, and the detail the status cannot carry.3
NumKong.swift:336 ↗
struct Error

Conforms to

Error, CustomStringConvertible, Equatable, Sendable
statusThe failure identity, shared with the C library.
NumKong.swift:338 ↗
let status: Status
messageThis binding's detail when it rejected the call itself, else empty.
NumKong.swift:340 ↗
let message: String
description
NumKong.swift:342 ↗
var description: String { get }