matrix-utilities
Tiny, high performance utilities for performing 2/3D matrix calculations. Full unit test coverage, compatible with Node/CommonJS, AMD, and browser globals.
Last updated 12 years ago by bcherny .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install matrix-utilities 
SYNC missed versions from official npm registry.

matrix-utilities

Tiny (516b gzipped), high performance utilities for performing 2/3D matrix calculations. Full unit test coverage, compatible with Node/CommonJS, AMD, and browser globals.

API

util = require 'matrix-utilities'

util.Identity() # returns new 3D identity matrix
util.multiply matrix1, matrix2 # returns matrix1×matrix2
util.flip matrix # flip a matrix along x=y
util.to2d matrix
util.to3d matrix

examples

util = require 'matrix-utilities'

# identity

matrix = util.Identity()
###
	#=>
	[
		[1, 0, 0, 0]
		[0, 1, 0, 0]
		[0, 0, 1, 0]
		[0, 0, 0, 1]
	]
###

# to2d

util.to2d matrix
###
	#=>
	[
		[1, 0, 0]
		[0, 1, 0]
	]
###

# flip

util.flip [
	[1, 2, 3]
	[4, 5, 6]
	[7, 8, 9]
]
###
	#=>
	[
		[1, 4, 7]
		[2, 5, 8]
		[3, 6, 9]
	]
###

# multiply

one = [
	[1, 2, 3]
	[4, 5, 6]
	[7, 8, 9]
]

two = [
	[1, 2]
	[3, 4]
	[5, 6]
]

util.multiply one, two
###
	#=>
	[
		[22, 28]
		[49, 64]
		[76, 100]
	]
###

Current Tags

  • 1.2.4                                ...           latest (12 years ago)

7 Versions

  • 1.2.4                                ...           12 years ago
  • 1.2.3                                ...           12 years ago
  • 1.2.2                                ...           12 years ago
  • 1.2.1                                ...           12 years ago
  • 1.1.1                                ...           12 years ago
  • 1.1.0                                ...           12 years ago
  • 1.0.0                                ...           13 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (5)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |