-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EXAMPLES] split examples into sep files.
- Loading branch information
Showing
5 changed files
with
57 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
var matrix = require( './../lib' ); | ||
|
||
var data, mat, i; | ||
|
||
data = new Int8Array( 5*2 ); | ||
for ( i = 0; i < data.length; i++ ) { | ||
data[ i ] = i; | ||
} | ||
|
||
mat = matrix( data, [5,2] ); | ||
|
||
// Copy a matrix: | ||
console.log( mat.sget( ':,:' ) ); | ||
|
||
// Extract a submatrix: | ||
console.log( mat.sget( '1:4,:' ) ); | ||
|
||
// Flip a matrix top-to-bottom: | ||
console.log( mat.sget( '::-1,:' ) ); | ||
|
||
// Flip a matrix left-to-right: | ||
console.log( mat.sget( ':,::-1' ) ); | ||
|
||
// Out-of-bounds subsequence: | ||
console.log( mat.sget( '50:100,:' ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
var matrix = require( './../lib' ); | ||
|
||
var data, A, B, i; | ||
|
||
data = new Int8Array( 10*10 ); | ||
for ( i = 0; i < data.length; i++ ) { | ||
data[ i ] = i; | ||
} | ||
// Create a 10x10 matrix: | ||
A = matrix( data, [10,10] ); | ||
|
||
// Extract a 4x4 submatrix from A: | ||
console.log( A.sget( '3:7,5:9' ) ); | ||
|
||
// Create a zero-filled matrix: | ||
B = matrix( [2,2], 'int8' ); | ||
|
||
// Set a submatrix in A to the zero-filled matrix B: | ||
A.sset( '4:6,6:8', B ); | ||
console.log( A.sget( '3:7,5:9' ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters