@@ -4,9 +4,9 @@ import { clone } from '../../utils/object.js'
44import { validateIndex } from '../../utils/array.js'
55
66const name = 'column'
7- const dependencies = [ 'typed' , 'Index' , 'matrix' , 'range' ]
7+ const dependencies = [ 'typed' , 'Index' , 'matrix' , 'range' , 'config' ]
88
9- export const createColumn = /* #__PURE__ */ factory ( name , dependencies , ( { typed, Index, matrix, range } ) => {
9+ export const createColumn = /* #__PURE__ */ factory ( name , dependencies , ( { typed, Index, matrix, range, config } ) => {
1010 /**
1111 * Return a column from a Matrix.
1212 *
@@ -19,7 +19,7 @@ export const createColumn = /* #__PURE__ */ factory(name, dependencies, ({ typed
1919 * // get a column
2020 * const d = [[1, 2], [3, 4]]
2121 * math.column(d, 1) // returns [[2], [4]]
22- *
22+ *np
2323 * See also:
2424 *
2525 * row
@@ -48,11 +48,19 @@ export const createColumn = /* #__PURE__ */ factory(name, dependencies, ({ typed
4848 throw new Error ( 'Only two dimensional matrix is supported' )
4949 }
5050
51+ // chek if legacySubset is enabled and disable it temporarily
52+ const originalConfigForLegacySubset = config ( ) . legacySubset
53+ if ( originalConfigForLegacySubset ) config ( { legacySubset : false } )
54+
5155 validateIndex ( column , value . size ( ) [ 1 ] )
5256
5357 const rowRange = range ( 0 , value . size ( ) [ 0 ] )
5458 const index = new Index ( rowRange , [ column ] )
5559 const result = value . subset ( index )
60+
61+ // restore original config for legacySubset
62+ if ( originalConfigForLegacySubset ) config ( { legacySubset : true } )
63+
5664 return isMatrix ( result )
5765 ? result
5866 : matrix ( [ [ result ] ] )
0 commit comments