class Rubellite::Spinel::Vector(T)

Overview

High-performance contiguous typed vector with SIMD math operations and zero-copy CRuby TypedData interoperability.

Included Modules

Defined in:

rubellite/spinel/vector.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Rubellite::TypedDataMixin

to_ruby : Value to_ruby

Constructor Detail

def self.new(elements : Array(T)) #

[View source]
def self.new(elements : Enumerable(T)) #

[View source]
def self.new(buffer : Slice(T)) #

[View source]
def self.new(size : Int32) #

[View source]

Class Method Detail

def self.setup_ruby_methods! : Nil #

Registers Ruby methods on the wrapped CRuby class


[View source]

Instance Method Detail

def [](index : Int) : T #

[View source]
def []=(index : Int, val : T) : T #

[View source]
def add!(other : Vector(T)) : self #

In-place element-wise addition: self += other


[View source]
def axpy!(factor : Number, other : Vector(T)) : self #

In-place BLAS axpy operation: self = factor * other + self


[View source]
def buffer : Slice(T) #

[View source]
def dot(other : Vector(T)) : T #

Computes the dot product of two vectors


[View source]
def inspect(io : IO) : Nil #
Description copied from class Reference

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>

[View source]
def multiply!(other : Vector(T)) : self #

In-place element-wise multiplication: self *= other


[View source]
def norm : Float64 #

Computes the Euclidean (L2) norm


[View source]
def norm_squared : Float64 #

Computes the squared Euclidean norm


[View source]
def scale(factor : Number) : Vector(T) #

Out-of-place scalar multiplication


[View source]
def scale!(factor : Number) : self #

In-place scalar multiplication


[View source]
def size : Int32 #

[View source]
def sum : T #

Computes the sum of all elements


[View source]
def to_a : Array(T) #

[View source]
def to_s(io : IO) : Nil #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]
def to_slice : Slice(T) #

[View source]
def to_unsafe : Pointer(T) #

[View source]