Skip to content

brandnewbox/simd-ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SIMD

SIMD is a library which exposes basic SIMD functionality for more efficient computation.

Support

Ruby (MRI) 1.9.3 and later is supported.

Using SIMD

Creating and Using SIMD Objects

SIMD objects can be created by passing Arrays of compatible objects to their appropriate constructors (see below, Available Types):

# Create a SIMD object for Float arithmetic
simd1 = SIMD::FloatArray.new([1.0, 2.0, 3.0, 4.0])
simd2 = SIMD::FloatArray.new([2.0, 4.0, 6.0, 8.0])

SIMD objects can be treated as numeric objects once created:

# Extract the result of multiplication of both sets
simd3 = simd1 * simd2

Use the to_a method to extract data from SIMD objects:

simd3.to_a
# => [2.0, 8.0, 18.0, 32.0]

Available Types

Currently the following types are available:

* double: FloatArray
* float:  SmallFloatArray
* int:    IntArray
* long:   LongArray

Contributions

Contributions are welcome! To contribute to the project, please:

* Fork the project.
* Make a topic branch for your contribution if it's more than a simple fix.
* Add tests for any new functionality/to verify that bugs have been fixed.
* Send a merge request on GitLab against the working branch.

Copyright © 2014-2018 Tina Wuest under the MIT license. See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 79.6%
  • Ruby 20.4%