middleman-wizard-template 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/lib/middleman-wizard-template/template.rb +14 -0
  3. data/lib/middleman-wizard-template/template/bowerjson.tt +7 -0
  4. data/lib/middleman-wizard-template/template/bowerrc.tt +3 -0
  5. data/lib/middleman-wizard-template/template/config.tt +5 -0
  6. data/lib/middleman-wizard-template/template/source/javascripts/site.js +4 -4
  7. data/lib/middleman-wizard-template/version.rb +1 -1
  8. metadata +4 -16
  9. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Matrix.js +0 -449
  10. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/PxLoader/PxLoader.js +0 -395
  11. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/PxLoader/PxLoaderImage.js +0 -96
  12. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/PxLoader/PxLoaderSwiffy.js +0 -68
  13. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/RouteRecognizer.js +0 -506
  14. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Slides.js +0 -846
  15. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Transform.js +0 -312
  16. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Tween.js +0 -719
  17. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/base.js +0 -8
  18. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/raf.js +0 -131
  19. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/statemachine.js +0 -1024
  20. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/useragent.js +0 -1244
  21. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/util.js +0 -282
  22. data/lib/middleman-wizard-template/template/source/javascripts/_lib/ww/viewport.js +0 -89
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35b547b31fb7f432f69044f4947b2be82ad820c0
4
- data.tar.gz: ac55e5b1572518f794db9d04a6486455c3c1c4cb
3
+ metadata.gz: 6fa66fe47ae3f621bfa26ea14d030dbff9097c40
4
+ data.tar.gz: c7797607a9da4e275c1cd3010c5e0dc531872ea7
5
5
  SHA512:
6
- metadata.gz: 251f7f5f63a92d3bb4033c3428aa6174693635ca1705d05562221ab3503224f31a36e54ff57dc355d5e5644955425e84210d6061e318a49b36a3e3141c1f9fed
7
- data.tar.gz: 567e046a9b67d808554425c3dd737bfa2843c63c54cfe4c8b81b16611e322f295231a3e3336e93597a0a5da444b22145e47598161e629a6346e627c21a35e1c0
6
+ metadata.gz: 8e6600b6ab3cb7dddfdc8e4ee13bdf409e7af0a01f838c64dc8b7fcd28906e86898b1b5f3c4e4493479b62a2e0cb30e8a8b443f890e1e3f564a7f7b1d965d943
7
+ data.tar.gz: c2b7491a1ff839fbbb2f3c0e9487791fbc8391c52f6c2834c0c727f36b8c3a7cd20f1e8ae414dc89ed9b5b6878c76ce2771e251857ca58b4dc679d1011fe9c0d
@@ -20,6 +20,20 @@ module Middleman
20
20
  # empty_directory File.join(location, "source", options[:js_dir])
21
21
  # empty_directory File.join(location, "source", options[:images_dir])
22
22
  end
23
+
24
+ class_option :'skip-bower', :type => :boolean, :default => false
25
+
26
+ # Write a Bundler Gemfile file for project
27
+ # @return [void]
28
+ def generate_bower!
29
+ return if options[:'skip-bower']
30
+ template "bowerrc.tt", File.join(location, ".bowerrc")
31
+ template "bowerjson.tt", File.join(location, "bower.json")
32
+
33
+ inside(location) do
34
+ run('npm install')
35
+ end unless ENV["TEST"]
36
+ end
23
37
  end
24
38
  end
25
39
  end
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "site_name",
3
+ "version": "0.0.0",
4
+ "dependencies": {
5
+ "ww": ">= 0.0.0"
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "directory": "source/javascripts/_components"
3
+ }
@@ -2,8 +2,13 @@ use Rack::Static, :urls => ["/closure"]
2
2
 
3
3
  set :haml, :attr_wrapper => '"'
4
4
 
5
+ config[:file_watcher_ignore] << %r{^closure\/}
6
+
5
7
  ready do
6
8
  ::Sprockets.unregister_postprocessor 'application/javascript', ::Sprockets::SafetyColons
9
+
10
+ # Bower
11
+ sprockets.append_path File.join(config[:js_dir], "_components")
7
12
  end
8
13
 
9
14
  # Preview Server
@@ -1,7 +1,7 @@
1
- //= require "_lib/ww/util"
2
- //= require "_lib/ww/raf"
3
- //= require "_lib/ww/Transform"
4
- //= require "_lib/ww/Tween"
1
+ //= require "_components/ww-util/util"
2
+ //= require "_components/ww-raf/raf"
3
+ //= require "_components/ww-transform/transform"
4
+ //= require "_components/ww-tween/tween"
5
5
 
6
6
  goog.provide('site_name');
7
7
  // goog.require('goog.History');
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module WizardTemplate
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-wizard-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-24 00:00:00.000000000 Z
12
+ date: 2013-07-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core
@@ -39,6 +39,8 @@ files:
39
39
  - lib/middleman-wizard-template.rb
40
40
  - lib/middleman-wizard-template/template.rb
41
41
  - lib/middleman-wizard-template/template/README.tt
42
+ - lib/middleman-wizard-template/template/bowerjson.tt
43
+ - lib/middleman-wizard-template/template/bowerrc.tt
42
44
  - lib/middleman-wizard-template/template/closure/compiler/COPYING
43
45
  - lib/middleman-wizard-template/template/closure/compiler/README
44
46
  - lib/middleman-wizard-template/template/closure/compiler/compiler.jar
@@ -1771,20 +1773,6 @@ files:
1771
1773
  - lib/middleman-wizard-template/template/config.tt
1772
1774
  - lib/middleman-wizard-template/template/shared/Gemfile.tt
1773
1775
  - lib/middleman-wizard-template/template/source/index.html.erb
1774
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Matrix.js
1775
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/PxLoader/PxLoader.js
1776
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/PxLoader/PxLoaderImage.js
1777
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/PxLoader/PxLoaderSwiffy.js
1778
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/RouteRecognizer.js
1779
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Slides.js
1780
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Transform.js
1781
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/Tween.js
1782
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/base.js
1783
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/raf.js
1784
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/statemachine.js
1785
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/useragent.js
1786
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/util.js
1787
- - lib/middleman-wizard-template/template/source/javascripts/_lib/ww/viewport.js
1788
1776
  - lib/middleman-wizard-template/template/source/javascripts/modernizr.js
1789
1777
  - lib/middleman-wizard-template/template/source/javascripts/site.js
1790
1778
  - lib/middleman-wizard-template/template/source/layouts/layout.erb
@@ -1,449 +0,0 @@
1
- goog.provide('Sylvester.Matrix');
2
-
3
- Sylvester.Matrix = function() {};
4
-
5
- Sylvester.Matrix.create = function(elements) {
6
- var M = new Sylvester.Matrix();
7
- return M.setElements(elements);
8
- };
9
- var $M = Sylvester.Matrix.create;
10
-
11
- Sylvester.Matrix.I = function(n) {
12
- var els = [], i = n, j;
13
- while (i--) { j = n;
14
- els[i] = [];
15
- while (j--) {
16
- els[i][j] = (i === j) ? 1 : 0;
17
- }
18
- }
19
- return Sylvester.Matrix.create(els);
20
- };
21
-
22
- Sylvester.Matrix.Diagonal = function(elements) {
23
- var i = elements.length;
24
- var M = Sylvester.Matrix.I(i);
25
- while (i--) {
26
- M.elements[i][i] = elements[i];
27
- }
28
- return M;
29
- };
30
-
31
- Sylvester.Matrix.Rotation = function(theta, a) {
32
- if (!a) {
33
- return Sylvester.Matrix.create([
34
- [Math.cos(theta), -Math.sin(theta)],
35
- [Math.sin(theta), Math.cos(theta)]
36
- ]);
37
- }
38
- var axis = a.dup();
39
- if (axis.elements.length !== 3) { return null; }
40
- var mod = axis.modulus();
41
- var x = axis.elements[0]/mod, y = axis.elements[1]/mod, z = axis.elements[2]/mod;
42
- var s = Math.sin(theta), c = Math.cos(theta), t = 1 - c;
43
- // Formula derived here: http://www.gamedev.net/reference/articles/article1199.asp
44
- // That proof rotates the co-ordinate system so theta becomes -theta and sin
45
- // becomes -sin here.
46
- return Sylvester.Matrix.create([
47
- [ t*x*x + c, t*x*y - s*z, t*x*z + s*y ],
48
- [ t*x*y + s*z, t*y*y + c, t*y*z - s*x ],
49
- [ t*x*z - s*y, t*y*z + s*x, t*z*z + c ]
50
- ]);
51
- };
52
-
53
- Sylvester.Matrix.RotationX = function(t) {
54
- var c = Math.cos(t), s = Math.sin(t);
55
- return Sylvester.Matrix.create([
56
- [ 1, 0, 0 ],
57
- [ 0, c, -s ],
58
- [ 0, s, c ]
59
- ]);
60
- };
61
- Sylvester.Matrix.RotationY = function(t) {
62
- var c = Math.cos(t), s = Math.sin(t);
63
- return Sylvester.Matrix.create([
64
- [ c, 0, s ],
65
- [ 0, 1, 0 ],
66
- [ -s, 0, c ]
67
- ]);
68
- };
69
- Sylvester.Matrix.RotationZ = function(t) {
70
- var c = Math.cos(t), s = Math.sin(t);
71
- return Sylvester.Matrix.create([
72
- [ c, -s, 0 ],
73
- [ s, c, 0 ],
74
- [ 0, 0, 1 ]
75
- ]);
76
- };
77
-
78
- Sylvester.Matrix.Random = function(n, m) {
79
- return Sylvester.Matrix.Zero(n, m).map(
80
- function() { return Math.random(); }
81
- );
82
- };
83
-
84
- Sylvester.Matrix.Zero = function(n, m) {
85
- var els = [], i = n, j;
86
- while (i--) { j = m;
87
- els[i] = [];
88
- while (j--) {
89
- els[i][j] = 0;
90
- }
91
- }
92
- return Sylvester.Matrix.create(els);
93
- };
94
-
95
- Sylvester.Matrix.prototype = {
96
- e: function(i,j) {
97
- if (i < 1 || i > this.elements.length || j < 1 || j > this.elements[0].length) { return null; }
98
- return this.elements[i-1][j-1];
99
- },
100
-
101
- row: function(i) {
102
- if (i > this.elements.length) { return null; }
103
- return Sylvester.Vector.create(this.elements[i-1]);
104
- },
105
-
106
- col: function(j) {
107
- if (this.elements.length === 0) { return null; }
108
- if (j > this.elements[0].length) { return null; }
109
- var col = [], n = this.elements.length;
110
- for (var i = 0; i < n; i++) { col.push(this.elements[i][j-1]); }
111
- return Sylvester.Vector.create(col);
112
- },
113
-
114
- dimensions: function() {
115
- var cols = (this.elements.length === 0) ? 0 : this.elements[0].length;
116
- return {rows: this.elements.length, cols: cols};
117
- },
118
-
119
- rows: function() {
120
- return this.elements.length;
121
- },
122
-
123
- cols: function() {
124
- if (this.elements.length === 0) { return 0; }
125
- return this.elements[0].length;
126
- },
127
-
128
- eql: function(matrix) {
129
- var M = matrix.elements || matrix;
130
- if (!M[0] || typeof(M[0][0]) === 'undefined') { M = Sylvester.Matrix.create(M).elements; }
131
- if (this.elements.length === 0 || M.length === 0) {
132
- return this.elements.length === M.length;
133
- }
134
- if (this.elements.length !== M.length) { return false; }
135
- if (this.elements[0].length !== M[0].length) { return false; }
136
- var i = this.elements.length, nj = this.elements[0].length, j;
137
- while (i--) { j = nj;
138
- while (j--) {
139
- if (Math.abs(this.elements[i][j] - M[i][j]) > Sylvester.precision) { return false; }
140
- }
141
- }
142
- return true;
143
- },
144
-
145
- dup: function() {
146
- return Sylvester.Matrix.create(this.elements);
147
- },
148
-
149
- map: function(fn, context) {
150
- if (this.elements.length === 0) { return Sylvester.Matrix.create([]); }
151
- var els = [], i = this.elements.length, nj = this.elements[0].length, j;
152
- while (i--) { j = nj;
153
- els[i] = [];
154
- while (j--) {
155
- els[i][j] = fn.call(context, this.elements[i][j], i + 1, j + 1);
156
- }
157
- }
158
- return Sylvester.Matrix.create(els);
159
- },
160
-
161
- isSameSizeAs: function(matrix) {
162
- var M = matrix.elements || matrix;
163
- if (typeof(M[0][0]) === 'undefined') { M = Sylvester.Matrix.create(M).elements; }
164
- if (this.elements.length === 0) { return M.length === 0; }
165
- return (this.elements.length === M.length &&
166
- this.elements[0].length === M[0].length);
167
- },
168
-
169
- add: function(matrix) {
170
- if (this.elements.length === 0) return this.map(function(x) { return x });
171
- var M = matrix.elements || matrix;
172
- if (typeof(M[0][0]) === 'undefined') { M = Sylvester.Matrix.create(M).elements; }
173
- if (!this.isSameSizeAs(M)) { return null; }
174
- return this.map(function(x, i, j) { return x + M[i-1][j-1]; });
175
- },
176
-
177
- subtract: function(matrix) {
178
- if (this.elements.length === 0) return this.map(function(x) { return x });
179
- var M = matrix.elements || matrix;
180
- if (typeof(M[0][0]) === 'undefined') { M = Sylvester.Matrix.create(M).elements; }
181
- if (!this.isSameSizeAs(M)) { return null; }
182
- return this.map(function(x, i, j) { return x - M[i-1][j-1]; });
183
- },
184
-
185
- canMultiplyFromLeft: function(matrix) {
186
- if (this.elements.length === 0) { return false; }
187
- var M = matrix.elements || matrix;
188
- if (typeof(M[0][0]) === 'undefined') { M = Sylvester.Matrix.create(M).elements; }
189
- // this.columns should equal matrix.rows
190
- return (this.elements[0].length === M.length);
191
- },
192
-
193
- multiply: function(matrix) {
194
- if (this.elements.length === 0) { return null; }
195
- if (!matrix.elements) {
196
- return this.map(function(x) { return x * matrix; });
197
- }
198
- var returnVector = matrix.modulus ? true : false;
199
- var M = matrix.elements || matrix;
200
- if (typeof(M[0][0]) === 'undefined') { M = Sylvester.Matrix.create(M).elements; }
201
- if (!this.canMultiplyFromLeft(M)) { return null; }
202
- var i = this.elements.length, nj = M[0].length, j;
203
- var cols = this.elements[0].length, c, elements = [], sum;
204
- while (i--) { j = nj;
205
- elements[i] = [];
206
- while (j--) { c = cols;
207
- sum = 0;
208
- while (c--) {
209
- sum += this.elements[i][c] * M[c][j];
210
- }
211
- elements[i][j] = sum;
212
- }
213
- }
214
- var M = Sylvester.Matrix.create(elements);
215
- return returnVector ? M.col(1) : M;
216
- },
217
-
218
- minor: function(a, b, c, d) {
219
- if (this.elements.length === 0) { return null; }
220
- var elements = [], ni = c, i, nj, j;
221
- var rows = this.elements.length, cols = this.elements[0].length;
222
- while (ni--) { i = c - ni - 1;
223
- elements[i] = [];
224
- nj = d;
225
- while (nj--) { j = d - nj - 1;
226
- elements[i][j] = this.elements[(a+i-1)%rows][(b+j-1)%cols];
227
- }
228
- }
229
- return Sylvester.Matrix.create(elements);
230
- },
231
-
232
- transpose: function() {
233
- if (this.elements.length === 0) return Sylvester.Matrix.create([]);
234
- var rows = this.elements.length, i, cols = this.elements[0].length, j;
235
- var elements = [], i = cols;
236
- while (i--) { j = rows;
237
- elements[i] = [];
238
- while (j--) {
239
- elements[i][j] = this.elements[j][i];
240
- }
241
- }
242
- return Sylvester.Matrix.create(elements);
243
- },
244
-
245
- isSquare: function() {
246
- var cols = (this.elements.length === 0) ? 0 : this.elements[0].length;
247
- return (this.elements.length === cols);
248
- },
249
-
250
- max: function() {
251
- if (this.elements.length === 0) { return null; }
252
- var m = 0, i = this.elements.length, nj = this.elements[0].length, j;
253
- while (i--) { j = nj;
254
- while (j--) {
255
- if (Math.abs(this.elements[i][j]) > Math.abs(m)) { m = this.elements[i][j]; }
256
- }
257
- }
258
- return m;
259
- },
260
-
261
- indexOf: function(x) {
262
- if (this.elements.length === 0) { return null; }
263
- var index = null, ni = this.elements.length, i, nj = this.elements[0].length, j;
264
- for (i = 0; i < ni; i++) {
265
- for (j = 0; j < nj; j++) {
266
- if (this.elements[i][j] === x) { return {i: i+1, j: j+1}; }
267
- }
268
- }
269
- return null;
270
- },
271
-
272
- diagonal: function() {
273
- if (!this.isSquare) { return null; }
274
- var els = [], n = this.elements.length;
275
- for (var i = 0; i < n; i++) {
276
- els.push(this.elements[i][i]);
277
- }
278
- return Sylvester.Vector.create(els);
279
- },
280
-
281
- toRightTriangular: function() {
282
- if (this.elements.length === 0) return Sylvester.Matrix.create([]);
283
- var M = this.dup(), els;
284
- var n = this.elements.length, i, j, np = this.elements[0].length, p;
285
- for (i = 0; i < n; i++) {
286
- if (M.elements[i][i] === 0) {
287
- for (j = i + 1; j < n; j++) {
288
- if (M.elements[j][i] !== 0) {
289
- els = [];
290
- for (p = 0; p < np; p++) { els.push(M.elements[i][p] + M.elements[j][p]); }
291
- M.elements[i] = els;
292
- break;
293
- }
294
- }
295
- }
296
- if (M.elements[i][i] !== 0) {
297
- for (j = i + 1; j < n; j++) {
298
- var multiplier = M.elements[j][i] / M.elements[i][i];
299
- els = [];
300
- for (p = 0; p < np; p++) {
301
- // Elements with column numbers up to an including the number of the
302
- // row that we're subtracting can safely be set straight to zero,
303
- // since that's the point of this routine and it avoids having to
304
- // loop over and correct rounding errors later
305
- els.push(p <= i ? 0 : M.elements[j][p] - M.elements[i][p] * multiplier);
306
- }
307
- M.elements[j] = els;
308
- }
309
- }
310
- }
311
- return M;
312
- },
313
-
314
- determinant: function() {
315
- if (this.elements.length === 0) { return 1; }
316
- if (!this.isSquare()) { return null; }
317
- var M = this.toRightTriangular();
318
- var det = M.elements[0][0], n = M.elements.length;
319
- for (var i = 1; i < n; i++) {
320
- det = det * M.elements[i][i];
321
- }
322
- return det;
323
- },
324
-
325
- isSingular: function() {
326
- return (this.isSquare() && this.determinant() === 0);
327
- },
328
-
329
- trace: function() {
330
- if (this.elements.length === 0) { return 0; }
331
- if (!this.isSquare()) { return null; }
332
- var tr = this.elements[0][0], n = this.elements.length;
333
- for (var i = 1; i < n; i++) {
334
- tr += this.elements[i][i];
335
- }
336
- return tr;
337
- },
338
-
339
- rank: function() {
340
- if (this.elements.length === 0) { return 0; }
341
- var M = this.toRightTriangular(), rank = 0;
342
- var i = this.elements.length, nj = this.elements[0].length, j;
343
- while (i--) { j = nj;
344
- while (j--) {
345
- if (Math.abs(M.elements[i][j]) > Sylvester.precision) { rank++; break; }
346
- }
347
- }
348
- return rank;
349
- },
350
-
351
- augment: function(matrix) {
352
- if (this.elements.length === 0) { return this.dup(); }
353
- var M = matrix.elements || matrix;
354
- if (typeof(M[0][0]) === 'undefined') { M = Sylvester.Matrix.create(M).elements; }
355
- var T = this.dup(), cols = T.elements[0].length;
356
- var i = T.elements.length, nj = M[0].length, j;
357
- if (i !== M.length) { return null; }
358
- while (i--) { j = nj;
359
- while (j--) {
360
- T.elements[i][cols + j] = M[i][j];
361
- }
362
- }
363
- return T;
364
- },
365
-
366
- inverse: function() {
367
- if (this.elements.length === 0) { return null; }
368
- if (!this.isSquare() || this.isSingular()) { return null; }
369
- var n = this.elements.length, i= n, j;
370
- var M = this.augment(Sylvester.Matrix.I(n)).toRightTriangular();
371
- var np = M.elements[0].length, p, els, divisor;
372
- var inverse_elements = [], new_element;
373
- // Sylvester.Matrix is non-singular so there will be no zeros on the
374
- // diagonal. Cycle through rows from last to first.
375
- while (i--) {
376
- // First, normalise diagonal elements to 1
377
- els = [];
378
- inverse_elements[i] = [];
379
- divisor = M.elements[i][i];
380
- for (p = 0; p < np; p++) {
381
- new_element = M.elements[i][p] / divisor;
382
- els.push(new_element);
383
- // Shuffle off the current row of the right hand side into the results
384
- // array as it will not be modified by later runs through this loop
385
- if (p >= n) { inverse_elements[i].push(new_element); }
386
- }
387
- M.elements[i] = els;
388
- // Then, subtract this row from those above it to give the identity matrix
389
- // on the left hand side
390
- j = i;
391
- while (j--) {
392
- els = [];
393
- for (p = 0; p < np; p++) {
394
- els.push(M.elements[j][p] - M.elements[i][p] * M.elements[j][i]);
395
- }
396
- M.elements[j] = els;
397
- }
398
- }
399
- return Sylvester.Matrix.create(inverse_elements);
400
- },
401
-
402
- round: function() {
403
- return this.map(function(x) { return Math.round(x); });
404
- },
405
-
406
- snapTo: function(x) {
407
- return this.map(function(p) {
408
- return (Math.abs(p - x) <= Sylvester.precision) ? x : p;
409
- });
410
- },
411
-
412
- inspect: function() {
413
- var matrix_rows = [];
414
- var n = this.elements.length;
415
- if (n === 0) return '[]';
416
- for (var i = 0; i < n; i++) {
417
- matrix_rows.push(Sylvester.Vector.create(this.elements[i]).inspect());
418
- }
419
- return matrix_rows.join('\n');
420
- },
421
-
422
- setElements: function(els) {
423
- var i, j, elements = els.elements || els;
424
- if (elements[0] && typeof(elements[0][0]) !== 'undefined') {
425
- i = elements.length;
426
- this.elements = [];
427
- while (i--) { j = elements[i].length;
428
- this.elements[i] = [];
429
- while (j--) {
430
- this.elements[i][j] = elements[i][j];
431
- }
432
- }
433
- return this;
434
- }
435
- var n = elements.length;
436
- this.elements = [];
437
- for (i = 0; i < n; i++) {
438
- this.elements.push([elements[i]]);
439
- }
440
- return this;
441
- }
442
- };
443
-
444
- Sylvester.Matrix.prototype.toUpperTriangular = Sylvester.Matrix.prototype.toRightTriangular;
445
- Sylvester.Matrix.prototype.det = Sylvester.Matrix.prototype.determinant;
446
- Sylvester.Matrix.prototype.tr = Sylvester.Matrix.prototype.trace;
447
- Sylvester.Matrix.prototype.rk = Sylvester.Matrix.prototype.rank;
448
- Sylvester.Matrix.prototype.inv = Sylvester.Matrix.prototype.inverse;
449
- Sylvester.Matrix.prototype.x = Sylvester.Matrix.prototype.multiply;