diff --git a/_data/package.json b/_data/package.json index b23b1ea..9dad320 100644 --- a/_data/package.json +++ b/_data/package.json @@ -1,7 +1,7 @@ { "name": "algebra", "description": "means completeness and balancing, from the Arabic word الجبر", - "version": "0.9.0", + "version": "0.10.0", "engines": { "node": ">= 4.4.0" }, @@ -13,9 +13,7 @@ "license": "MIT", "main": "index.js", "scripts": { - "_build": "npm test && npm run browserify && npm run minify && npm run tex && npm run jekyll; git status", - "_pull": "git pull origin master && npm run gh-pages:pull", - "_push": "git push origin master && npm run gh-pages:push", + "build": "npm test && npm run browserify && npm run minify && npm run tex && npm run jekyll; git status", "browserify": "npm run browserify:dist; npm run browserify:test", "browserify:dist": "browserify -r ./index.js:${npm_package_name} -t babelify -o dist/${npm_package_name}.js", "browserify:test": "browserify test/*.js -t babelify -o gh-pages/test/bundle.js", @@ -39,7 +37,12 @@ "tex:display": "ls gh-pages/tex-snippets/display/*.tex | while read texfile; do cat $texfile | katex --display-mode > gh-pages/_includes/display/$(basename ${texfile%.tex}).html; done", "tex:inline": "ls gh-pages/tex-snippets/inline/*.tex | while read texfile; do cat $texfile | katex > gh-pages/_includes/inline/$(basename ${texfile%.tex}).html; done", "postversion": "git push origin v${npm_package_version}; npm publish; npm run _push", - "test": "mocha --reporter min" + "postpublish": "npm run gh-pages:_data; git commit -am ':arrow_up: updated version'; npm run push", + "postupdate-deps": "npm test && git commit -am ':arrow_up: updated deps' || git checkout -- package.json", + "pull": "git pull origin master && npm run gh-pages:pull", + "push": "git push origin master && npm run gh-pages:push", + "test": "mocha --reporter min", + "update-deps": "npm update --save --dev" }, "pre-commit": [ "lint", @@ -50,6 +53,7 @@ "type": "git", "url": "git://github.com/fibo/algebra.git" }, + "changelog": "gh-pages/changelog.md", "keywords": [ "algebra", "matrix", @@ -65,14 +69,13 @@ "babelify": "^7.2.0", "browserify": "^13.0.0", "coveralls": "^2.11.9", - "install": "^0.6.1", "istanbul": "^0.4.1", - "katex": "^0.5.1", + "katex": "^0.6.0", "mocha": "^2.3.4", "mocha-lcov-reporter": "1.2.0", "pre-commit": "^1.1.2", - "should": "^8.3.1", - "standard": "^6.0.8", + "should": "^9.0.0", + "standard": "^7.0.0", "uglify-js": "^2.6.2" }, "dependencies": { @@ -80,7 +83,6 @@ "cayley-dickson": "^0.3.0", "indices-permutations": "^0.2.0", "inherits": "^2.0.1", - "is-integer": "^1.0.6", "laplace-determinant": "^0.1.0", "matrix-multiplication": "^0.4.0", "multidim-array-index": "^0.5.0", diff --git a/_data/tags.json b/_data/tags.json index 2c447a7..45cf6d7 100644 --- a/_data/tags.json +++ b/_data/tags.json @@ -1,4 +1,13 @@ [ + { + "name": "v0.10.0", + "zipball_url": "https://api.github.com/repos/fibo/algebra/zipball/v0.10.0", + "tarball_url": "https://api.github.com/repos/fibo/algebra/tarball/v0.10.0", + "commit": { + "sha": "f403137ce9c5c5a8eb2467a2fbcbf989df02ff75", + "url": "https://api.github.com/repos/fibo/algebra/commits/f403137ce9c5c5a8eb2467a2fbcbf989df02ff75" + } + }, { "name": "v0.9.0", "zipball_url": "https://api.github.com/repos/fibo/algebra/zipball/v0.9.0", diff --git a/changelog.md b/changelog.md index a6935ee..4b98b4e 100644 --- a/changelog.md +++ b/changelog.md @@ -15,8 +15,13 @@ Changelog format adheres to [Keep a Changelog](http://keepachangelog.com/) ## [Unreleased] +## [v0.10.1] - 2016-06-09 + - Replaced jshint with standardjs - fixed math formulas rendering in blog +- few tests added +- few doc improvements +- using new static-props features ## [v0.10.0] - 2016-04-16 diff --git a/index.md b/index.md index 4ffb361..13ea05c 100644 --- a/index.md +++ b/index.md @@ -5,7 +5,7 @@ title: algebra > Vectors, Matrices; Real, Complex, Quaternion; custom groups and rings for Node.js -[![Node engine](https://img.shields.io/node/v/algebra.svg)](https://nodejs.org/en/) [![NPM version](https://badge.fury.io/js/algebra.svg)](http://badge.fury.io/js/algebra) [![Build Status](https://travis-ci.org/fibo/algebra.svg?branch=master)](https://travis-ci.org/fibo/algebra?branch=master) [![Dependency Status](https://gemnasium.com/fibo/algebra.svg)](https://gemnasium.com/fibo/algebra) [![Coverage Status](https://coveralls.io/repos/fibo/algebra/badge.svg?branch=master)](https://coveralls.io/r/fibo/algebra?branch=master) [![Test page](https://img.shields.io/badge/test-page-blue.svg)](http://g14n.info/algebra/test) [![Change log](https://img.shields.io/badge/change-log-blue.svg)](http://g14n.info/algebra/changelog) +[![Node engine](https://img.shields.io/node/v/algebra.svg)](https://nodejs.org/en/) [![NPM version](https://badge.fury.io/js/algebra.svg)](http://badge.fury.io/js/algebra) [![Build Status](https://travis-ci.org/fibo/algebra.svg?branch=master)](https://travis-ci.org/fibo/algebra?branch=master) [![Dependency Status](https://david-dm.org/fibo/algebra.svg)](https://david-dm.org/fibo/algebra) [![Coverage Status](https://coveralls.io/repos/fibo/algebra/badge.svg?branch=master)](https://coveralls.io/r/fibo/algebra?branch=master) [![Test page](https://img.shields.io/badge/test-page-blue.svg)](http://g14n.info/algebra/test) [![Change log](https://img.shields.io/badge/change-log-blue.svg)](http://g14n.info/algebra/changelog) [![Whatchers](https://g14n.info/svg/github/watchers/algebra.svg)](https://github.com/fibo/algebra/watchers) [![Stargazers](https://g14n.info/svg/github/stars/algebra.svg)](https://github.com/fibo/algebra/stargazers) [![Forks](https://g14n.info/svg/github/forks/algebra.svg)](https://github.com/fibo/algebra/network/members) @@ -13,7 +13,7 @@ title: algebra ![Algebra](http://g14n.info/algebra/images/Cover-Algebra.png) ![OnQuaternionsAndOctonions](http://g14n.info/algebra/images/Cover-OnQuaternionsAndOctonions.png) -**Table Of Contents:** +## Table Of Contents * [Status](#status) * [Features](#features) @@ -26,56 +26,14 @@ title: algebra - [About operators](#about-operators) - [Cyclic](#cyclic) - [Scalar](#scalar) - - [attributes](#scalar-attributes) - - [one](#scalarone) - - [zero](#scalarzero) - - [data](#scalardata) - - [order](#scalar-order) - - [operators](#scalar-operators) - - [equality](#scalar-equality) - - [disequality](#scalar-disequality) - - [addition](#scalar-addition) - - [subtraction](#scalar-subtraction) - - [multiplication](#scalar-multiplication) - - [division](#scalar-division) - - [negation](#scalar-negation) - - [inversion](#scalar-inversion) - - [conjugation](#scalar-conjugation) - [Real](#real) - [Complex](#complex) - [Quaternion](#quaternion) - [Octonion](#octonion) - [Common spaces](#common-spaces) - - [R](#r) - - [R2](#r2) - - [R3](#r3) - - [R2x2](#r2x2) - - [C](#c) - - [H](#h) - [Vector](#vector) - - [attributes](#vector-attributes) - - [operators](#vector-operators) - - [cross product](#cross-product) - [Matrix](#matrix) - - [attributes](#matrix-attributes) - - [isSquare](#matrixissquare) - - [numCols](#matrixnumcols) - - [numRows](#matrixnumrows) - - [operators](#matrix-operators) - - [multiplication](#matrix-multiplication) - - [inversion](#matrix-inversion) - - [determinant](#matrix-determinant) - - [adjoint](#matrix-adjoint) - [Tensor](#tensor) - - [attributes](#tensor-attributes) - - [one](#tensorone) - - [zero](#tensorzero) - - [data](#tensordata) - - [indices](#tensor-indices) - - [order](#tensor-order) - - [operators](#tensor-operators) - - [equality](#tensor-equality) - - [scalarMultiplication](#scalar-multiplication) * [License](#license) ## Status @@ -86,21 +44,21 @@ I am currently adding more tests and examples to achieve a stable version. Many functionalities of previous versions are now in separated atomic packages: -* [algebra-cyclic](http://npm.im/algebra-cyclic) -* [algebra-group](http://npm.im/algebra-group) -* [algebra-ring][algebra-ring] -* [cayley-dickson](http://npm.im/cayley-dickson) -* [indices-permutations](http://npm.im/indices-permutations) -* [laplace-determinant](http://npm.im/laplace-determinant) -* [matrix-multiplication](http://npm.im/matrix-multiplication) -* [multidim-array-index](http://npm.im/multidim-array-index) -* [tensor-contraction](http://npm.im/tensor-contraction) -* [tensor-permutation](http://npm.im/tensor-product) +* [algebra-cyclic] +* [algebra-group] +* [algebra-ring] +* [cayley-dickson] +* [indices-permutations] +* [laplace-determinant] +* [matrix-multiplication] +* [multidim-array-index] +* [tensor-contraction] +* [tensor-permutation] ## Features * Real, Complex, Quaternion, Octonion numbers. -* [Vector](#vectors) and [Matrix](#matrices) spaces over any field (included [Real numbers](#scalars), of course :). +* [Vector](#vectors) and [Matrix](#matrices) spaces over any field (included [Real numbers](#real), of course :). * Expressive syntax. * Everything is a Tensor. * [Immutable objects](https://en.wikipedia.org/wiki/Immutable_object). @@ -108,13 +66,13 @@ Many functionalities of previous versions are now in separated atomic packages: ## Installation -With [npm](https://npmjs.org/) do +With [npm] do ```bash npm install algebra ``` -With [bower](http://bower.io/) do +With [bower] do ```bash bower install algebra @@ -576,10 +534,43 @@ Inherits everything from [Tensor](#tensor). ### Vector attributes -##### `Vector.dimension` +#### Vector dimension + +##### `Vector dimension` + +```javascript +R2.dimension // 2 +``` + +##### `vector.dimension` + +```javascript +var vector = new R2([1, 1]) + +vector.dimension // 2 +``` ### Vector operators +#### Addition + +##### `Vector.addition(vector1, vector2)` + +```javascript +R2.addition([2, 1], [1, 2]) // [3, 3] +``` + +##### `vector1.addition(vector2)` + +```javascript +var vector1 = new R2([2, 1]) +var vector2 = new R2([2, 2]) + +var vector3 = vector1.addition(vector2) + +vector3 // Vector { data: [4, 3] } +``` + #### Cross product It is defined only in dimension three. See [Cross product on wikipedia](https://en.wikipedia.org/wiki/Cross_product). @@ -736,8 +727,19 @@ tensor2.equality(tensor2) // false [MIT](http://g14n.info/mit-license/) +[npm]: https://npmjs.org/ +[bower]: http://bower.io/ [blog]: http://g14n.info/algebra/articles "algebra blog" -[algebra-ring]: http://npm.im/algebra-ring "algebra-ring" [composition-algebra]: https://en.wikipedia.org/wiki/Composition_algebra "Composition algebra" [booleanField]: https://github.com/fibo/algebra/blob/master/src/booleanField.js "boolean field" [realField]: https://github.com/fibo/algebra/blob/master/src/realField.js "real field" +[algebra-cyclic]: http://npm.im/algebra-cyclic +[algebra-group]: http://npm.im/algebra-group +[algebra-ring]: http://npm.im/algebra-ring +[cayley-dickson]: http://npm.im/cayley-dickson +[indices-permutations]: http://npm.im/indices-permutations +[laplace-determinant]: http://npm.im/laplace-determinant +[matrix-multiplication]: http://npm.im/matrix-multiplication +[multidim-array-index]: http://npm.im/multidim-array-index +[tensor-contraction]: http://npm.im/tensor-contraction +[tensor-permutation]: http://npm.im/tensor-product diff --git a/test/bundle.js b/test/bundle.js index 5263f19..f352f9c 100644 --- a/test/bundle.js +++ b/test/bundle.js @@ -199,11 +199,11 @@ module.exports = staticProps module.exports={ "_args": [ [ - "algebra-cyclic@^0.2.0", + "algebra-cyclic@0.2.0", "/home/io/github.com/fibo/algebra" ] ], - "_from": "algebra-cyclic@>=0.2.0 <0.3.0", + "_from": "algebra-cyclic@0.2.0", "_id": "algebra-cyclic@0.2.0", "_inCache": true, "_installable": true, @@ -221,18 +221,19 @@ module.exports={ "_phantomChildren": {}, "_requested": { "name": "algebra-cyclic", - "raw": "algebra-cyclic@^0.2.0", - "rawSpec": "^0.2.0", + "raw": "algebra-cyclic@0.2.0", + "rawSpec": "0.2.0", "scope": null, - "spec": ">=0.2.0 <0.3.0", - "type": "range" + "spec": "0.2.0", + "type": "version" }, "_requiredBy": [ "/" ], + "_resolved": "https://registry.npmjs.org/algebra-cyclic/-/algebra-cyclic-0.2.0.tgz", "_shasum": "d66e5dd19c8dab497c9115456376b3ab84b7756b", "_shrinkwrap": null, - "_spec": "algebra-cyclic@^0.2.0", + "_spec": "algebra-cyclic@0.2.0", "_where": "/home/io/github.com/fibo/algebra", "author": { "name": "Gianluca Casati", @@ -1119,11 +1120,11 @@ arguments[4][3][0].apply(exports,arguments) module.exports={ "_args": [ [ - "matrix-multiplication@^0.4.0", + "matrix-multiplication@0.4.0", "/home/io/github.com/fibo/algebra" ] ], - "_from": "matrix-multiplication@>=0.4.0 <0.5.0", + "_from": "matrix-multiplication@0.4.0", "_id": "matrix-multiplication@0.4.0", "_inCache": true, "_installable": true, @@ -1141,18 +1142,19 @@ module.exports={ "_phantomChildren": {}, "_requested": { "name": "matrix-multiplication", - "raw": "matrix-multiplication@^0.4.0", - "rawSpec": "^0.4.0", + "raw": "matrix-multiplication@0.4.0", + "rawSpec": "0.4.0", "scope": null, - "spec": ">=0.4.0 <0.5.0", - "type": "range" + "spec": "0.4.0", + "type": "version" }, "_requiredBy": [ "/" ], + "_resolved": "https://registry.npmjs.org/matrix-multiplication/-/matrix-multiplication-0.4.0.tgz", "_shasum": "d63c0885ecd788fa9290c16f483ef50fa16c13a1", "_shrinkwrap": null, - "_spec": "matrix-multiplication@^0.4.0", + "_spec": "matrix-multiplication@0.4.0", "_where": "/home/io/github.com/fibo/algebra", "author": { "name": "Gianluca Casati", @@ -1282,11 +1284,11 @@ module.exports = multiDimArrayIndex module.exports={ "_args": [ [ - "multidim-array-index@^0.5.0", + "multidim-array-index@0.5.0", "/home/io/github.com/fibo/algebra" ] ], - "_from": "multidim-array-index@>=0.5.0 <0.6.0", + "_from": "multidim-array-index@0.5.0", "_id": "multidim-array-index@0.5.0", "_inCache": true, "_installable": true, @@ -1304,18 +1306,19 @@ module.exports={ "_phantomChildren": {}, "_requested": { "name": "multidim-array-index", - "raw": "multidim-array-index@^0.5.0", - "rawSpec": "^0.5.0", + "raw": "multidim-array-index@0.5.0", + "rawSpec": "0.5.0", "scope": null, - "spec": ">=0.5.0 <0.6.0", - "type": "range" + "spec": "0.5.0", + "type": "version" }, "_requiredBy": [ "/" ], + "_resolved": "https://registry.npmjs.org/multidim-array-index/-/multidim-array-index-0.5.0.tgz", "_shasum": "34aceea031769c419df016819329142b0332bd07", "_shrinkwrap": null, - "_spec": "multidim-array-index@^0.5.0", + "_spec": "multidim-array-index@0.5.0", "_where": "/home/io/github.com/fibo/algebra", "author": { "name": "Gianluca Casati", @@ -1882,9 +1885,9 @@ function MatrixSpace(Scalar) { trace: trace(data) }); - Object.defineProperties(this, { - determinant: { get: computeDeterminant }, - det: { get: computeDeterminant } + staticProps(this)({ + determinant: computeDeterminant, + det: computeDeterminant }); } @@ -1900,9 +1903,9 @@ function MatrixSpace(Scalar) { } } - Object.defineProperties(this, { - transposed: { get: transposed }, - tr: { get: transposed } + staticProps(this)({ + transposed: transposed, + tr: transposed }); } @@ -2646,25 +2649,22 @@ describe('CompositionAlgebra', function () { },{"../src/CompositionAlgebra":28,"../src/realField":37}],41:[function(require,module,exports){ 'use strict'; -var algebra = require('algebra'); +describe('MatrixSpace', function () { + var algebra = require('algebra'); -var notDefined = require('not-defined'); + var notDefined = require('not-defined'); -var MatrixSpace = algebra.MatrixSpace; -var Real = algebra.Real; -var VectorSpace = algebra.VectorSpace; + var MatrixSpace = algebra.MatrixSpace; + var Real = algebra.Real; -var methodBinaryOperator = require('./features/methodBinaryOperator'); -var methodUnaryOperator = require('./features/methodUnaryOperator'); -var staticBinaryOperator = require('./features/staticBinaryOperator'); -var staticUnaryOperator = require('./features/staticUnaryOperator'); + var methodBinaryOperator = require('./features/methodBinaryOperator'); + var staticBinaryOperator = require('./features/staticBinaryOperator'); + var staticUnaryOperator = require('./features/staticUnaryOperator'); -describe('MatrixSpace', function () { var R1x4 = MatrixSpace(Real)(1, 4); var R2x3 = MatrixSpace(Real)(2, 3); var R2x2 = MatrixSpace(Real)(2); var R3x2 = MatrixSpace(Real)(3, 2); - var R4 = VectorSpace(Real)(4); it('has signature (Scalar)(numRows, numCols)', function () { R2x3.numRows.should.be.eql(2); @@ -2766,9 +2766,9 @@ describe('MatrixSpace', function () { }); describe('trace()', function () { - it('is a static method', function () { - R2x2.trace([1, 2, 5, 6]).should.be.eql(7); - }); + var operator = 'trace'; + + it('is a static method', staticUnaryOperator(R2x2, operator, [1, 2, 5, 6], 7)); it('is not available for no square matrices', function () { notDefined(R3x2.trace).should.be.true; @@ -2853,14 +2853,14 @@ describe('MatrixSpace', function () { describe('tr', function () { it('is an alias of transposed', function () { - var matrix = new R2x2([0, 1, 1, 0]); + var matrix = new R3x2([0, 1, 1, 0, 2, 2]); - matrix.tr.should.be.eql(matrix.transposed); + matrix.tr.data.should.be.eql(matrix.transposed.data); }); }); }); -},{"./features/methodBinaryOperator":49,"./features/methodUnaryOperator":50,"./features/staticBinaryOperator":51,"./features/staticUnaryOperator":52,"algebra":53,"not-defined":20}],42:[function(require,module,exports){ +},{"./features/methodBinaryOperator":49,"./features/staticBinaryOperator":51,"./features/staticUnaryOperator":52,"algebra":53,"not-defined":20}],42:[function(require,module,exports){ 'use strict'; var algebra = require('algebra'); @@ -2873,7 +2873,8 @@ var staticBinaryOperator = require('./features/staticBinaryOperator'); var staticUnaryOperator = require('./features/staticUnaryOperator'); describe('Real', function () { - var operator, x; + var operator; + var x; describe('zero', function () { it('is static', function () { @@ -2894,9 +2895,6 @@ describe('Real', function () { it('is a class method', methodBinaryOperator(R, operator, 1, 2, 3)); - // TODO - //it('accepts many arguments', multiArgumentOperator(R, operator, 1, [2, 3, 4], 10)) - it('accepts many arguments', function () { x = new R(1); x = x.addition(2, 3, 4); @@ -3111,22 +3109,25 @@ describe('TensorSpace', function () { describe('order', function () { it('is 0 for scalars', function () { var Scalar = TensorSpace(Real)([1]); - var scalar1 = new Scalar(4); Scalar.order.should.eql(0); + + var scalar1 = new Scalar(4); scalar1.order.should.eql(0); }); it('is 1 for vectors', function () { var Vector = TensorSpace(Real)([2]); - var vector1 = new Vector([1, 2]); Vector.order.should.eql(1); + + var vector1 = new Vector([1, 2]); vector1.order.should.eql(1); }); it('is 2 for matrices', function () { var Matrix = TensorSpace(Real)([2, 2]); - var matrix1 = new Matrix([1, 2, 3, 4]); Matrix.order.should.eql(2); + + var matrix1 = new Matrix([1, 2, 3, 4]); matrix1.order.should.eql(2); }); }); @@ -3180,20 +3181,16 @@ describe('TensorSpace', function () { var algebra = require('algebra'); var notDefined = require('not-defined'); -var MatrixSpace = algebra.MatrixSpace; var Real = algebra.Real; var VectorSpace = algebra.VectorSpace; var methodBinaryOperator = require('./features/methodBinaryOperator'); -var methodUnaryOperator = require('./features/methodUnaryOperator'); var staticBinaryOperator = require('./features/staticBinaryOperator'); var staticUnaryOperator = require('./features/staticUnaryOperator'); var R2 = VectorSpace(Real)(2); var R3 = VectorSpace(Real)(3); -var R2x2 = MatrixSpace(Real)(2, 2); - describe('VectorSpace', function () { var operator; @@ -3298,22 +3295,23 @@ describe('VectorSpace', function () { }); describe('norm()', function () { + var operator = 'norm'; + it('is a static method', function () { - R2.norm([0, 1]).data.should.be.eql(1); - R3.norm([1, 1, 2]).data.should.be.eql(6); + staticUnaryOperator(R2, operator, [0, 1], 1); + staticUnaryOperator(R3, operator, [1, 1, 2], 6); }); }); describe('crossProduct()', function () { + var operator = 'crossProduct'; + it('is a static method', function () { - R3.crossProduct([3, -3, 1], [4, 9, 2]).should.be.eql([-15, -2, 39]); + staticBinaryOperator(R3, operator, [3, -3, 1], [4, 9, 2], [-15, -2, 39]); }); it('is a class method', function () { - var vector1 = new R3([3, -3, 1]); - var vector2 = new R3([-12, 12, -4]); - - vector1.crossProduct(vector2).data.should.be.eql([0, 0, 0]); + methodBinaryOperator(R3, operator, [3, -3, 1], [-12, 12, -4], [0, 0, 0]); }); it('is defined only in dimension 3', function () { @@ -3334,7 +3332,7 @@ describe('VectorSpace', function () { }); }); -},{"./features/methodBinaryOperator":49,"./features/methodUnaryOperator":50,"./features/staticBinaryOperator":51,"./features/staticUnaryOperator":52,"algebra":53,"not-defined":20}],46:[function(require,module,exports){ +},{"./features/methodBinaryOperator":49,"./features/staticBinaryOperator":51,"./features/staticUnaryOperator":52,"algebra":53,"not-defined":20}],46:[function(require,module,exports){ 'use strict'; describe('API', function () { @@ -3347,9 +3345,12 @@ describe('API', function () { var R = algebra.R; var R2 = algebra.R2; var R3 = algebra.R3; + var R2x2 = algebra.R2x2; var Real = algebra.Real; var Scalar = algebra.Scalar; + var MatrixSpace = algebra.MatrixSpace; var TensorSpace = algebra.TensorSpace; + var VectorSpace = algebra.VectorSpace; var booleanField = require('../src/booleanField'); @@ -3429,40 +3430,64 @@ describe('API', function () { describe('Common spaces', function () { describe('R', function () { - it('is an alias', function () { + it('is an alias of Real', function () { R.should.be.eql(Real); }); }); describe('R2', function () { - it(); + it('is an alias of VectorSpace(Real)(2)', function () { + R2.should.be.eql(VectorSpace(Real)(2)); + }); }); - /* 'is an alias', () => { - }*/describe('R3', function () { - it(); + describe('R3', function () { + it('is an alias of VectorSpace(Real)(3)', function () { + R3.should.be.eql(VectorSpace(Real)(3)); + }); }); - /* 'is an alias', () => { - }*/describe('R2x2', function () { - it(); + describe('R2x2', function () { + it('is an alias of MatrixSpace(Real)(2)', function () { + R2x2.should.be.eql(MatrixSpace(Real)(2)); + }); }); - /* 'is an alias', () => { - }*/describe('C', function () { - it('is an alias', function () { + describe('C', function () { + it('is an alias of Complex', function () { C.should.be.eql(Complex); }); }); describe('H', function () { - it('is an alias', function () { + it('is an alias of Quaternion', function () { H.should.be.eql(Quaternion); }); }); }); - describe('Tensor', function () { + describe('Vector', function () { + describe('vector.dimension', function () { + it('is an attribute', function () { + var vector = new R2([1, 1]); + + vector.dimension.should.eql(2); + }); + }); + + describe('addition', function () { + it('works', function () { + R2.addition([2, 1], [1, 2]).should.deepEqual([3, 3]); + + var vector1 = new R2([2, 1]); + var vector2 = new R2([2, 2]); + + var vector3 = vector1.addition(vector2); + + vector3.data.should.deepEqual([4, 3]); + }); + }); + describe('Cross product', function () { it('works', function () { R3.crossProduct([3, -3, 1], [4, 9, 2]).should.deepEqual([-15, -2, 39]);