diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/README.md b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/README.md
new file mode 100644
index 000000000000..7c8e43f9d6e5
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/README.md
@@ -0,0 +1,147 @@
+
+
+# resultsFactory
+
+> Create a new constructor for creating a k-means clustering results object.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var resultsFactory = require( '@stdlib/ml/base/kmeans/results/factory' );
+```
+
+#### resultsFactory( dtype )
+
+Returns a constructor for creating a k-means clustering results object.
+
+```javascript
+var Results = resultsFactory( 'float64' );
+// returns
+
+var r = new Results();
+// returns
+```
+
+The function supports the following parameters:
+
+- **dtype**: floating-point data type for storing floating-point results. Must be either `'float64'` or `'float32'`.
+
+
+
+
+
+
+
+
+
+## Notes
+
+- A results object is a [`struct`][@stdlib/dstructs/struct] providing a fixed-width composite data structure for storing k-means clustering results and providing an ABI-stable data layout for JavaScript-C interoperation.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var resultsFactory = require( '@stdlib/ml/base/kmeans/results/factory' );
+
+var Results = resultsFactory( 'float64' );
+var results = new Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+});
+
+var str = results.toString();
+console.log( str );
+
+Results = resultsFactory( 'float32' );
+results = new Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+});
+
+str = results.toString();
+console.log( str );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/dstructs/struct]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/dstructs/struct
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/benchmark/benchmark.js
new file mode 100644
index 000000000000..61d8755d75b3
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/benchmark/benchmark.js
@@ -0,0 +1,106 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var isFunction = require( '@stdlib/assert/is-function' );
+var isObject = require( '@stdlib/assert/is-object' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var factory = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ 'float64',
+ 'float32'
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = factory( values[ i%values.length ] );
+ if ( typeof v !== 'function' ) {
+ b.fail( 'should return a function' );
+ }
+ }
+ b.toc();
+ if ( !isFunction( v ) ) {
+ b.fail( 'should return a function' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s::constructor,new', pkg ), function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ factory( 'float64' ),
+ factory( 'float32' )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = new ( values[ i%values.length ] )();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s::constructor,no_new', pkg ), function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ factory( 'float64' ),
+ factory( 'float32' )
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = values[ i%values.length ]();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/docs/repl.txt
new file mode 100644
index 000000000000..df1624e59534
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/docs/repl.txt
@@ -0,0 +1,24 @@
+
+{{alias}}( dtype )
+ Returns a constructor for creating a k-means clustering results object.
+
+ Parameters
+ ----------
+ dtype: string
+ Floating-point data type for storing floating-point results.
+
+ Returns
+ -------
+ fcn: Function
+ Constructor.
+
+ Examples
+ --------
+ > var R = {{alias}}( 'float64' );
+ > var r = new R();
+ > r.toString()
+
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/docs/types/index.d.ts
new file mode 100644
index 000000000000..9ccb0d2df695
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/docs/types/index.d.ts
@@ -0,0 +1,228 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+/**
+* Clustering algorithm.
+*/
+type Algorithm = 'lloyd' | 'elkan';
+
+/**
+* Distance metric.
+*/
+type Metric = 'sqeuclidean' | 'correlation' | 'cosine' | 'cityblock';
+
+/**
+* Interface describing clustering results.
+*/
+interface Results {
+ /*
+ * Number of times the data was clustered with different initial centroids.
+ */
+ replicates?: number;
+
+ /*
+ * Index of the initial centroids which produced the best result.
+ */
+ replicate?: number;
+
+ /*
+ * Distance metric.
+ */
+ metric?: Metric;
+
+ /*
+ * Number of iterations for best results.
+ */
+ iterations?: number;
+
+ /*
+ * Clustering algorithm.
+ */
+ algorithm?: Algorithm;
+
+ /*
+ * Sum of squared distances to the closest centroid for all samples.
+ */
+ inertia?: number;
+
+ /*
+ * Number of clusters.
+ */
+ k?: number;
+
+ /*
+ * Number of samples.
+ */
+ samples?: number;
+
+ /*
+ * Number of features.
+ */
+ features?: number;
+}
+
+/**
+* Interface describing options when serializing a results object to a string.
+*/
+interface ToStringOptions {
+ /**
+ * Number of digits to display after decimal points. Default: `4`.
+ */
+ digits?: number;
+}
+
+/**
+* Interface describing a results data structure.
+*/
+declare class ResultsStruct {
+ /**
+ * Results constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns results
+ */
+ constructor( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number );
+
+ /*
+ * Number of times the data was clustered with different initial centroids.
+ */
+ replicates: number;
+
+ /*
+ * Index of the initial centroids which produced the best result.
+ */
+ replicate: number;
+
+ /*
+ * Distance metric.
+ */
+ metric: Metric;
+
+ /*
+ * Number of iterations for best results.
+ */
+ iterations: number;
+
+ /*
+ * Clustering algorithm.
+ */
+ algorithm: Algorithm;
+
+ /*
+ * Number of clusters.
+ */
+ k: number;
+
+ /*
+ * Number of samples.
+ */
+ samples: number;
+
+ /*
+ * Number of features.
+ */
+ features: number;
+
+ /*
+ * Sum of squared distances to the closest centroid for all samples.
+ */
+ inertia: number;
+
+ /**
+ * Clustering method.
+ */
+ method: string;
+
+ /**
+ * Serializes a results object as a formatted string.
+ *
+ * @param options - options object
+ * @returns serialized results
+ */
+ toString( options?: ToStringOptions ): string;
+
+ /**
+ * Serializes a results object as a JSON object.
+ *
+ * @returns serialized object
+ */
+ toJSON(): object;
+
+ /**
+ * Returns a DataView of a results object.
+ *
+ * @returns DataView
+ */
+ toDataView(): DataView;
+}
+
+/**
+* Interface defining a results constructor which is both "newable" and "callable".
+*/
+interface ResultsConstructor {
+ /**
+ * Results constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns struct
+ */
+ new( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number ): ResultsStruct;
+
+ /**
+ * Results constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns struct
+ */
+ ( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number ): ResultsStruct;
+}
+
+/**
+* Returns a new results constructor for creating a k-means clustering results object.
+*
+* @param dtype - floating-point data type for storing floating-point results
+* @returns results constructor
+*
+* @example
+* var Results = resultsFactory( 'float64' );
+* // returns
+*
+* var r = new Results();
+* // returns
+*
+* @example
+* var Results = resultsFactory( 'float32' );
+* // returns
+*
+* var r = new Results();
+* // returns
+*/
+declare function resultsFactory( dtype: 'float64' | 'float32' ): ResultsConstructor;
+
+
+// EXPORTS //
+
+export = resultsFactory;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/docs/types/test.ts
new file mode 100644
index 000000000000..6bfacfa9c397
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/docs/types/test.ts
@@ -0,0 +1,205 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import resultsFactory = require( './index' );
+
+
+// TESTS //
+
+// The function returns a function...
+{
+ resultsFactory( 'float64' ); // $ExpectType ResultsConstructor
+ resultsFactory( 'float32' ); // $ExpectType ResultsConstructor
+}
+
+// The compiler throws an error if not provided a supported data type...
+{
+ resultsFactory( 10 ); // $ExpectError
+ resultsFactory( true ); // $ExpectError
+ resultsFactory( false ); // $ExpectError
+ resultsFactory( null ); // $ExpectError
+ resultsFactory( undefined ); // $ExpectError
+ resultsFactory( [] ); // $ExpectError
+ resultsFactory( {} ); // $ExpectError
+ resultsFactory( ( x: number ): number => x ); // $ExpectError
+}
+
+// The function returns a function which returns a results object...
+{
+ const Results = resultsFactory( 'float64' );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = new Results( new ArrayBuffer( 80 ) ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = new Results( new ArrayBuffer( 80 ), 8 ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = new Results( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ResultsStruct
+}
+
+// The returned constructor can be invoked without `new`...
+{
+ const Results = resultsFactory( 'float64' );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = Results( new ArrayBuffer( 80 ) ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = Results( new ArrayBuffer( 80 ), 8 ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = Results( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ResultsStruct
+}
+
+// The results object has the expected properties (float64)...
+{
+ const Results = resultsFactory( 'float64' );
+ const r = new Results( {} );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.replicates; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.replicate; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.metric; // $ExpectType Metric
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.iterations; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.algorithm; // $ExpectType Algorithm
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.inertia; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.k; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.samples; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.features; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.method; // $ExpectType string
+}
+
+// The results object has the expected properties (float32)...
+{
+ const Results = resultsFactory( 'float32' );
+ const r = new Results( {} );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.replicates; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.replicate; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.metric; // $ExpectType Metric
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.iterations; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.algorithm; // $ExpectType Algorithm
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.inertia; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.k; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.samples; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.features; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.method; // $ExpectType string
+}
+
+// The compiler throws an error if the constructor is provided a first argument which is not an ArrayBuffer or object...
+{
+ const Results = resultsFactory( 'float64' );
+
+ new Results( 'abc' ); // $ExpectError
+ new Results( 123 ); // $ExpectError
+ new Results( true ); // $ExpectError
+ new Results( false ); // $ExpectError
+ new Results( null ); // $ExpectError
+ new Results( [] ); // $ExpectError
+ new Results( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a second argument which is not a number...
+{
+ const Results = resultsFactory( 'float64' );
+
+ new Results( new ArrayBuffer( 80 ), 'abc' ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), true ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), false ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), null ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), [] ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), {} ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a third argument which is not a number...
+{
+ const Results = resultsFactory( 'float64' );
+
+ new Results( new ArrayBuffer( 80 ), 8, 'abc' ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, true ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, false ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, null ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, [] ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, {} ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, ( x: number ): number => x ); // $ExpectError
+}
+
+// The results object has a `toString` method...
+{
+ const Results = resultsFactory( 'float64' );
+ const r = new Results( {} );
+
+ r.toString(); // $ExpectType string
+ r.toString( {} ); // $ExpectType string
+ r.toString( { 'digits': 4 } ); // $ExpectType string
+}
+
+// The results object has a `toJSON` method...
+{
+ const Results = resultsFactory( 'float64' );
+ const r = new Results( {} );
+
+ r.toJSON(); // $ExpectType object
+}
+
+// The results object has a `toDataView` method...
+{
+ const Results = resultsFactory( 'float64' );
+ const r = new Results( {} );
+
+ r.toDataView(); // $ExpectType DataView
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/examples/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/examples/index.js
new file mode 100644
index 000000000000..327186ee84f1
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/examples/index.js
@@ -0,0 +1,53 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var resultsFactory = require( './../lib' );
+
+var Results = resultsFactory( 'float64' );
+var results = new Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+});
+
+var str = results.toString();
+console.log( str );
+
+Results = resultsFactory( 'float32' );
+results = new Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+});
+
+str = results.toString();
+console.log( str );
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/lib/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/lib/index.js
new file mode 100644
index 000000000000..3641ee5f496c
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/lib/index.js
@@ -0,0 +1,55 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Return a constructor for creating a k-means clustering results object.
+*
+* @module @stdlib/ml/base/kmeans/results/factory
+*
+* @example
+* var resultsFactory = require( '@stdlib/ml/base/kmeans/results/factory' );
+*
+* var Results = resultsFactory( 'float64' );
+*
+* var results = new Results();
+* // returns
+*
+* results.replicates = 3;
+* results.replicate = 1;
+* results.metric = 'sqeuclidean';
+* results.iterations = 4;
+* results.algorithm = 'lloyd';
+* results.inertia = 3.28;
+* results.k = 4;
+* results.samples = 10;
+* results.features = 3;
+*
+* var str = results.toString();
+* // returns
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/lib/main.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/lib/main.js
new file mode 100644
index 000000000000..91d79dc12d2c
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/lib/main.js
@@ -0,0 +1,467 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/* eslint-disable no-invalid-this, no-restricted-syntax */
+
+'use strict';
+
+// MODULES //
+
+var isArrayBuffer = require( '@stdlib/assert/is-arraybuffer' );
+var isObject = require( '@stdlib/assert/is-object' );
+var hasProp = require( '@stdlib/assert/has-property' );
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var setReadWriteAccessor = require( '@stdlib/utils/define-nonenumerable-read-write-accessor' );
+var setReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' );
+var propertyDescriptor = require( '@stdlib/utils/property-descriptor' );
+var contains = require( '@stdlib/array/base/assert/contains' ).factory;
+var join = require( '@stdlib/array/base/join' );
+var objectAssign = require( '@stdlib/object/assign' );
+var inherit = require( '@stdlib/utils/inherit' );
+var resolveMetricStr = require( '@stdlib/ml/base/kmeans/metric-resolve-str' );
+var resolveMetricEnum = require( '@stdlib/ml/base/kmeans/metric-resolve-enum' );
+var resolveAlgorithmStr = require( '@stdlib/ml/base/kmeans/algorithm-resolve-str' );
+var resolveAlgorithmEnum = require( '@stdlib/ml/base/kmeans/algorithm-resolve-enum' );
+var structFactory = require( '@stdlib/ml/base/kmeans/results/struct-factory' );
+var res2json = require( '@stdlib/ml/base/kmeans/results/to-json' );
+var res2str = require( '@stdlib/ml/base/kmeans/results/to-string' );
+var format = require( '@stdlib/string/format' );
+
+
+// VARIABLES //
+
+var DTYPES = [
+ 'float64',
+ 'float32'
+];
+
+var isDataType = contains( DTYPES );
+
+
+// MAIN //
+
+/**
+* Returns a constructor for creating a k-means clustering results object.
+*
+* @param {string} dtype - storage data type for floating-point values
+* @throws {TypeError} first argument must be a supported data type
+* @returns {Function} constructor
+*
+* @example
+* var Results = factory( 'float64' );
+*
+* var results = new Results();
+* // returns
+*
+* results.replicates = 3;
+* results.replicate = 1;
+* results.metric = 'sqeuclidean';
+* results.iterations = 4;
+* results.algorithm = 'lloyd';
+* results.inertia = 3.28;
+* results.k = 4;
+* results.samples = 10;
+* results.features = 3;
+*
+* var str = results.toString();
+* // returns
+*/
+function factory( dtype ) {
+ var algorithmDescriptor;
+ var metricDescriptor;
+ var Struct;
+
+ if ( !isDataType( dtype ) ) {
+ throw new TypeError( format( 'invalid argument. First argument must be one of the following: "%s". Value: `%s`.', join( DTYPES, ', ' ), dtype ) );
+ }
+
+ // Create a struct constructor:
+ Struct = structFactory( dtype );
+
+ // Cache references to property descriptors on the parent prototype so that we can intercept the return values:
+ algorithmDescriptor = propertyDescriptor( Struct.prototype, 'algorithm' );
+ metricDescriptor = propertyDescriptor( Struct.prototype, 'metric' );
+
+ /**
+ * Returns a k-means clustering results object.
+ *
+ * @private
+ * @constructor
+ * @param {(ArrayBuffer|Object)} [arg] - underlying byte buffer or a data object
+ * @param {NonNegativeInteger} [byteOffset] - byte offset
+ * @param {NonNegativeInteger} [byteLength] - maximum byte length
+ * @throws {TypeError} first argument must be an ArrayBuffer or a data object
+ * @returns {Results} results object
+ */
+ function Results( arg, byteOffset, byteLength ) {
+ var nargs;
+ var args;
+ var v;
+ var i;
+
+ nargs = arguments.length;
+ if ( !( this instanceof Results ) ) {
+ if ( nargs === 0 ) {
+ return new Results();
+ }
+ if ( nargs === 1 ) {
+ return new Results( arg );
+ }
+ if ( nargs === 2 ) {
+ return new Results( arg, byteOffset );
+ }
+ return new Results( arg, byteOffset, byteLength );
+ }
+ args = [];
+ if ( nargs > 0 ) {
+ if ( isArrayBuffer( arg ) ) {
+ for ( i = 0; i < nargs; i++ ) {
+ args.push( arguments[ i ] );
+ }
+ } else if ( isObject( arg ) ) {
+ args.push( objectAssign( {}, arg ) );
+
+ // Resolve string-valued enumeration fields to their integer values prior to delegating to the parent constructor...
+ if ( hasProp( args[ 0 ], 'algorithm' ) ) {
+ v = resolveAlgorithmEnum( args[ 0 ].algorithm );
+ args[ 0 ].algorithm = ( v === null ) ? NaN : v;
+ }
+ if ( hasProp( args[ 0 ], 'metric' ) ) {
+ v = resolveMetricEnum( args[ 0 ].metric );
+ args[ 0 ].metric = ( v === null ) ? NaN : v;
+ }
+ } else {
+ throw new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer or a data object. Value: `%s`.', arg ) );
+ }
+ }
+ // Call the parent constructor...
+ Struct.apply( this, args );
+ return this;
+ }
+
+ /*
+ * Inherit from the parent constructor.
+ */
+ inherit( Results, Struct );
+
+ /**
+ * Constructor name.
+ *
+ * @private
+ * @name name
+ * @memberof Results
+ * @readonly
+ * @type {string}
+ */
+ setReadOnly( Results, 'name', Struct.name );
+
+ /**
+ * Alignment.
+ *
+ * @private
+ * @name alignment
+ * @memberof Results
+ * @readonly
+ * @type {PositiveInteger}
+ */
+ setReadOnly( Results, 'alignment', Struct.alignment );
+
+ /**
+ * Size (in bytes) of the `struct`.
+ *
+ * @private
+ * @name byteLength
+ * @memberof Results
+ * @readonly
+ * @type {PositiveInteger}
+ */
+ setReadOnly( Results, 'byteLength', Struct.byteLength );
+
+ /**
+ * Returns a list of `struct` fields.
+ *
+ * @private
+ * @name fields
+ * @memberof Results
+ * @readonly
+ * @type {Array}
+ */
+ setReadOnlyAccessor( Results, 'fields', function get() {
+ return Struct.fields;
+ });
+
+ /**
+ * Returns a string corresponding to the `struct` layout.
+ *
+ * @private
+ * @name layout
+ * @memberof Results
+ * @readonly
+ * @type {string}
+ */
+ setReadOnlyAccessor( Results, 'layout', function get() {
+ return Struct.layout;
+ });
+
+ /**
+ * Returns the underlying byte buffer of a `struct`.
+ *
+ * @private
+ * @name bufferOf
+ * @memberof Results
+ * @readonly
+ * @type {Function}
+ * @param {Object} obj - struct instance
+ * @throws {TypeError} must provide a `struct` instance
+ * @returns {ArrayBuffer} underlying byte buffer
+ */
+ setReadOnly( Results, 'bufferOf', Struct.bufferOf );
+
+ /**
+ * Returns the length, in bytes, of the value specified by the provided field name.
+ *
+ * @private
+ * @name byteLengthOf
+ * @memberof Results
+ * @readonly
+ * @type {Function}
+ * @param {string} name - field name
+ * @throws {Error} struct must have at least one field
+ * @throws {TypeError} must provide a recognized field name
+ * @returns {NonNegativeInteger} byte length
+ */
+ setReadOnly( Results, 'byteLengthOf', Struct.byteLengthOf );
+
+ /**
+ * Returns the offset, in bytes, from the beginning of a `struct` to the value specified by the provided field name.
+ *
+ * @private
+ * @name byteOffsetOf
+ * @memberof Results
+ * @readonly
+ * @type {Function}
+ * @param {string} name - field name
+ * @throws {Error} struct must have at least one field
+ * @throws {TypeError} must provide a recognized field name
+ * @returns {NonNegativeInteger} byte offset
+ */
+ setReadOnly( Results, 'byteOffsetOf', Struct.byteOffsetOf );
+
+ /**
+ * Returns the description associated with a provided field name.
+ *
+ * @private
+ * @name descriptionOf
+ * @memberof Results
+ * @readonly
+ * @type {Function}
+ * @param {string} name - field name
+ * @throws {Error} struct must have at least one field
+ * @throws {TypeError} must provide a recognized field name
+ * @returns {string} description
+ */
+ setReadOnly( Results, 'descriptionOf', Struct.descriptionOf );
+
+ /**
+ * Returns a boolean indicating whether a provided value is a `struct` instance.
+ *
+ * @private
+ * @name isStruct
+ * @memberof Results
+ * @readonly
+ * @type {Function}
+ * @param {*} value - input value
+ * @returns {boolean} boolean indicating whether a value is a `struct` instance
+ */
+ setReadOnly( Results, 'isStruct', Struct.isStruct );
+
+ /**
+ * Returns the type associated with a provided field name.
+ *
+ * @private
+ * @name typeOf
+ * @memberof Results
+ * @readonly
+ * @type {Function}
+ * @param {string} name - field name
+ * @throws {Error} struct must have at least one field
+ * @throws {TypeError} must provide a recognized field name
+ * @returns {(string|Object)} type
+ */
+ setReadOnly( Results, 'typeOf', Struct.typeOf );
+
+ /**
+ * Returns the underlying byte buffer of a `struct` as a `DataView`.
+ *
+ * @private
+ * @name viewOf
+ * @memberof Results
+ * @readonly
+ * @type {Function}
+ * @param {Object} obj - struct instance
+ * @throws {TypeError} must provide a `struct` instance
+ * @returns {DataView} view of underlying byte buffer
+ */
+ setReadOnly( Results, 'viewOf', Struct.viewOf );
+
+ /**
+ * Analysis name.
+ *
+ * @private
+ * @name method
+ * @memberof Results.prototype
+ * @type {string}
+ * @default 'K-means clustering'
+ */
+ setReadOnly( Results.prototype, 'method', 'K-means clustering' );
+
+ /**
+ * Distance metric.
+ *
+ * @private
+ * @name metric
+ * @memberof Results.prototype
+ * @type {string}
+ */
+ setReadWriteAccessor( Results.prototype, 'metric', getMetric, setMetric );
+
+ /**
+ * Clustering algorithm.
+ *
+ * @private
+ * @name algorithm
+ * @memberof Results.prototype
+ * @type {string}
+ */
+ setReadWriteAccessor( Results.prototype, 'algorithm', getAlgorithm, setAlgorithm );
+
+ /**
+ * Serializes a results object as a string.
+ *
+ * ## Notes
+ *
+ * - Example output:
+ *
+ * ```text
+ *
+ * K-means clustering using Lloyd algorithm
+ *
+ * metric used: squared euclidean
+ * total replicates: 4
+ * best replicate: 2
+ * total iterations: 10
+ * inertia: 3.2800
+ *
+ * Clustering ran for 4 clusters and 10 data samples, each with 3 features
+ *
+ * ```
+ *
+ * @private
+ * @name toString
+ * @memberof Results.prototype
+ * @type {Function}
+ * @param {Options} [opts] - options object
+ * @param {PositiveInteger} [opts.digits=4] - number of digits after the decimal point
+ * @throws {TypeError} options argument must be an object
+ * @throws {TypeError} must provide valid options
+ * @returns {string} serialized results
+ */
+ setReadOnly( Results.prototype, 'toString', function toString( opts ) {
+ if ( arguments.length ) {
+ return res2str( this, opts );
+ }
+ return res2str( this );
+ });
+
+ /**
+ * Serializes a results object as a JSON object.
+ *
+ * ## Notes
+ *
+ * - `JSON.stringify()` implicitly calls this method when stringifying a `Results` instance.
+ *
+ * @private
+ * @name toJSON
+ * @memberof Results.prototype
+ * @type {Function}
+ * @returns {Object} serialized object
+ */
+ setReadOnly( Results.prototype, 'toJSON', function toJSON() {
+ return res2json( this );
+ });
+
+ /**
+ * Returns a DataView of a results object.
+ *
+ * @private
+ * @name toDataView
+ * @memberof Results.prototype
+ * @type {Function}
+ * @returns {DataView} DataView
+ */
+ setReadOnly( Results.prototype, 'toDataView', function toDataView() {
+ return Struct.viewOf( this );
+ });
+
+ return Results;
+
+ /**
+ * Returns the distance metric.
+ *
+ * @private
+ * @returns {string} distance metric
+ */
+ function getMetric() {
+ return resolveMetricStr( metricDescriptor.get.call( this ) );
+ }
+
+ /**
+ * Sets the distance metric.
+ *
+ * @private
+ * @param {string} value - distance metric
+ */
+ function setMetric( value ) {
+ metricDescriptor.set.call( this, resolveMetricEnum( value ) );
+ }
+
+ /**
+ * Returns the clustering algorithm.
+ *
+ * @private
+ * @returns {string} clustering algorithm
+ */
+ function getAlgorithm() {
+ return resolveAlgorithmStr( algorithmDescriptor.get.call( this ) );
+ }
+
+ /**
+ * Sets the clustering algorithm.
+ *
+ * @private
+ * @param {string} value - clustering algorithm
+ */
+ function setAlgorithm( value ) {
+ algorithmDescriptor.set.call( this, resolveAlgorithmEnum( value ) );
+ }
+}
+
+
+// EXPORTS //
+
+module.exports = factory;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/package.json b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/package.json
new file mode 100644
index 000000000000..79b120da68cc
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/package.json
@@ -0,0 +1,68 @@
+{
+ "name": "@stdlib/ml/base/kmeans/results/factory",
+ "version": "0.0.0",
+ "description": "Return a constructor for creating a k-means clustering results object.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "ml",
+ "machine-learning",
+ "cluster",
+ "clustering",
+ "kmeans",
+ "k-means",
+ "utilities",
+ "utility",
+ "utils",
+ "util",
+ "constructor",
+ "ctor",
+ "results"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/test/test.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/test/test.js
new file mode 100644
index 000000000000..9dda0b125719
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/factory/test/test.js
@@ -0,0 +1,643 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var isDataView = require( '@stdlib/assert/is-dataview' );
+var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
+var ArrayBuffer = require( '@stdlib/array/buffer' );
+var f32 = require( '@stdlib/number/float64/base/to-float32' );
+var Number = require( '@stdlib/number/ctor' );
+var resultsFactory = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof resultsFactory, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not a supported data type', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ resultsFactory( value );
+ };
+ }
+});
+
+tape( 'the function returns a constructor which throws an error if provided a first argument which is not an ArrayBuffer or data object', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = resultsFactory( 'float64' );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ results( value );
+ };
+ }
+});
+
+tape( 'the function returns a constructor which throws an error if provided a second argument which is not a nonnegative integer', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = resultsFactory( 'float64' );
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ results( new ArrayBuffer( 1024 ), value );
+ };
+ }
+});
+
+tape( 'the function returns a constructor which throws an error if provided a third argument which is not a nonnegative integer', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = resultsFactory( 'float64' );
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ results( new ArrayBuffer( 1024 ), 0, value );
+ };
+ }
+});
+
+tape( 'the function returns a constructor which does not require the `new` operator', function test( t ) {
+ var results;
+ var res;
+
+ results = resultsFactory( 'float64' );
+
+ res = results();
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( {} );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( new ArrayBuffer( 1024 ) );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( new ArrayBuffer( 1024 ), 0 );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( new ArrayBuffer( 1024 ), 0, 1024 );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width results object (dtype=float64)', function test( t ) {
+ var expected;
+ var Results;
+ var actual;
+
+ Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ actual = new Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ });
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width results object (dtype=float32)', function test( t ) {
+ var expected;
+ var Results;
+ var actual;
+
+ Results = resultsFactory( 'float32' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ actual = new Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': f32( 3.28 ),
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ });
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': f32( 3.28 ),
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width results object (no arguments)', function test( t ) {
+ var expected;
+ var Results;
+ var actual;
+
+ Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ actual = new Results();
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = 3.28;
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width results object (empty object)', function test( t ) {
+ var expected;
+ var Results;
+ var actual;
+
+ Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ actual = new Results( {} );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = 3.28;
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width results object (ArrayBuffer)', function test( t ) {
+ var expected;
+ var Results;
+ var actual;
+ var buf;
+
+ Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Results( buf );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = 3.28;
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width results object (ArrayBuffer, byteOffset)', function test( t ) {
+ var expected;
+ var Results;
+ var actual;
+ var buf;
+
+ Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Results( buf, 16 );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = 3.28;
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor for creating a fixed-width results object (ArrayBuffer, byteOffset, byteLength)', function test( t ) {
+ var expected;
+ var Results;
+ var actual;
+ var buf;
+
+ Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Results( buf, 16, 160 );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = 3.28;
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor which returns an instance having a method property', function test( t ) {
+ var Results;
+ var results;
+
+ Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ results = new Results();
+
+ t.strictEqual( results.method, 'K-means clustering', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor which returns an instance having a `toString` method', function test( t ) {
+ var Results;
+ var results;
+ var actual;
+
+ Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ results = new Results();
+
+ actual = results.toString();
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+
+ actual = results.toString({
+ 'digits': 4
+ });
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor which returns an instance having a `toJSON` method', function test( t ) {
+ var Results;
+ var results;
+
+ Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ results = new Results();
+ t.strictEqual( typeof results.toJSON, 'function', 'returns expected value' );
+ t.strictEqual( typeof results.toJSON(), 'object', 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a constructor which returns an instance having a `toDataView` method', function test( t ) {
+ var Results;
+ var results;
+
+ Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+
+ results = new Results();
+ t.strictEqual( typeof results.toDataView, 'function', 'returns expected value' );
+ t.strictEqual( isDataView( results.toDataView() ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `name` property', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( typeof Results.name, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having an `alignment` property', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( typeof Results.alignment, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `byteLength` property', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( typeof Results.byteLength, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `fields` property', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( isStringArray( Results.fields ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `layout` property', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( typeof Results.layout, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `bufferOf` method', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( typeof Results.bufferOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `byteLengthOf` method', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( typeof Results.byteLengthOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `byteOffsetOf` method', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( typeof Results.byteOffsetOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `descriptionOf` method', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( typeof Results.descriptionOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having an `isStruct` method', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( typeof Results.isStruct, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns a constructor having a `viewOf` method', function test( t ) {
+ var Results = resultsFactory( 'float64' );
+ t.strictEqual( typeof Results, 'function', 'returns expected value' );
+ t.strictEqual( typeof Results.viewOf, 'function', 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/README.md b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/README.md
new file mode 100644
index 000000000000..9b9431239d41
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/README.md
@@ -0,0 +1,431 @@
+
+
+# Float32Results
+
+> Create a k-means clustering single-precision floating-point results object.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var Float32Results = require( '@stdlib/ml/base/kmeans/results/float32' );
+```
+
+#### Float32Results( \[arg\[, byteOffset\[, byteLength]]] )
+
+Returns a k-means clustering single-precision floating-point results object.
+
+```javascript
+var results = new Float32Results();
+// returns {...}
+```
+
+The function supports the following parameters:
+
+- **arg**: an [`ArrayBuffer`][@stdlib/array/buffer] or a data object (_optional_).
+- **byteOffset**: byte offset (_optional_).
+- **byteLength**: maximum byte length (_optional_).
+
+A data object argument is an object having one or more of the following properties:
+
+- **replicates**: number of times the data was clustered with different initial centroids.
+- **replicate**: index of the initial centroids which produced the best result.
+- **metric**: distance metric. (e.g., `'sqeuclidean'`, `'correlation'`, `'cosine'`, or `'cityblock'`).
+- **iterations**: number of iterations for best results.
+- **algorithm**: clustering algorithm. (e.g., `'lloyd'`, or `'elkan'`)
+- **inertia**: sum of squared distances to the closest centroid for all samples.
+- **k**: number of clusters.
+- **samples**: number of samples.
+- **features**: number of features.
+
+#### Float32Results.prototype.replicates
+
+Number of times the data was clustered with different initial centroids.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.replicates );
+// return 0
+```
+
+#### Float32Results.prototype.replicate
+
+Index of the initial centroids which produced the best result.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.replicate );
+// return 0
+```
+
+#### Float32Results.prototype.metric
+
+Distance metric.
+
+```javascript
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = results.metric;
+// returns
+```
+
+#### Float32Results.prototype.iterations
+
+Number of iterations for best results.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.iterations );
+// return 0
+```
+
+#### Float32Results.prototype.algorithm
+
+Clustering algorithm.
+
+```javascript
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = results.algorithm;
+// returns
+```
+
+#### Float32Results.prototype.inertia
+
+Sum of squared distances to the closest centroid for all samples.
+
+```javascript
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = results.inertia;
+// returns
+```
+
+#### Float32Results.prototype.k
+
+Number of clusters.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.k );
+// return 0
+```
+
+#### Float32Results.prototype.samples
+
+Number of samples.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.samples );
+// return 0
+```
+
+#### Float32Results.prototype.features
+
+Number of features.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.features );
+// return 0
+```
+
+#### Float32Results.prototype.toString( \[options] )
+
+Serializes a results object to a formatted string.
+
+```javascript
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = results.toString();
+// returns
+```
+
+The method supports the following options:
+
+- **digits**: number of digits to display after decimal points. Default: `4`.
+
+Example output:
+
+```text
+
+K-means clustering using Lloyd algorithm
+
+ metric used: squared euclidean
+ total replicates: 4
+ best replicate: 2
+ total iterations: 10
+ inertia: 3.2800
+
+Clustering ran for 4 clusters and 10 data samples, each with 3 features
+
+```
+
+#### Float32Results.prototype.toJSON( \[options] )
+
+Serializes a results object as a JSON object.
+
+```javascript
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = results.toJSON();
+// returns {...}
+```
+
+`JSON.stringify()` implicitly calls this method when stringifying a results instance.
+
+#### Float32Results.prototype.toDataView()
+
+Returns a [`DataView`][@stdlib/array/dataview] of a results object.
+
+```javascript
+var results = new Float32Results();
+// returns {...}
+
+// ...
+
+var v = results.toDataView();
+// returns
+```
+
+
+
+
+
+
+
+
+
+## Notes
+
+- A results object is a [`struct`][@stdlib/dstructs/struct] providing a fixed-width composite data structure for storing k-means clustering results and providing an ABI-stable data layout for JavaScript-C interoperation.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Results = require( '@stdlib/ml/base/kmeans/results/float32' );
+
+var results = new Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+});
+
+var str = results.toString({
+ 'format': 'linear'
+});
+console.log( str );
+```
+
+
+
+
+
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/ml/base/kmeans/results/float32.h"
+```
+
+#### stdlib_ml_base_kmeans_float32_results
+
+Structure for holding single-precision floating-point kmeans clustering results.
+
+```c
+#include
+#include
+
+struct stdlib_ml_kmeans_float32_results {
+ // Number of times the data was clustered with different initial centroids:
+ int64_t replicates;
+
+ // Index of the initial centroids which produced the best result:
+ int64_t replicate;
+
+ // Distance metric:
+ int8_t metric;
+
+ // Number of iterations for best results:
+ int64_t iterations;
+
+ // Clustering algorithm:
+ int8_t algorithm;
+
+ // Sum of squared distances to the closest centroid for all samples:
+ float inertia;
+
+ // Number of clusters:
+ int64_t k;
+
+ // Number of samples:
+ int64_t samples;
+
+ // Number of features:
+ int64_t features;
+};
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/dstructs/struct]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/dstructs/struct
+
+[@stdlib/array/dataview]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/dataview
+
+[@stdlib/array/buffer]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/buffer
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/benchmark/benchmark.js
new file mode 100644
index 000000000000..961ca455f3b9
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/benchmark/benchmark.js
@@ -0,0 +1,71 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var isObject = require( '@stdlib/assert/is-object' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var Float32Results = require( './../lib' );
+
+
+// MAIN //
+
+bench( format( '%s::constructor,new', pkg ), function benchmark( b ) {
+ var v;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = new Float32Results();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s::constructor,no_new', pkg ), function benchmark( b ) {
+ var results;
+ var v;
+ var i;
+
+ results = Float32Results;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = results();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/docs/repl.txt
new file mode 100644
index 000000000000..3df9b86a1fc6
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/docs/repl.txt
@@ -0,0 +1,29 @@
+
+{{alias}}( [arg[, byteOffset[, byteLength]]] )
+ Returns a k-means clustering single-precision floating-point results object.
+
+ Parameters
+ ----------
+ arg: Object|ArrayBuffer (optional)
+ ArrayBuffer or data object.
+
+ byteOffset: integer (optional)
+ Byte offset.
+
+ byteLength: integer (optional)
+ Maximum byte length.
+
+ Returns
+ -------
+ out: Object
+ Results object.
+
+ Examples
+ --------
+ > var r = new {{alias}}();
+ > r.toString()
+
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/docs/types/index.d.ts
new file mode 100644
index 000000000000..a75b8989d037
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/docs/types/index.d.ts
@@ -0,0 +1,233 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+/**
+* Clustering algorithm.
+*/
+type Algorithm = 'lloyd' | 'elkan';
+
+/**
+* Distance metric.
+*/
+type Metric = 'sqeuclidean' | 'correlation' | 'cosine' | 'cityblock';
+
+/**
+* Interface describing clustering results.
+*/
+interface Results {
+ /*
+ * Number of times the data was clustered with different initial centroids.
+ */
+ replicates?: number;
+
+ /*
+ * Index of the initial centroids which produced the best result.
+ */
+ replicate?: number;
+
+ /*
+ * Distance metric.
+ */
+ metric?: Metric;
+
+ /*
+ * Number of iterations for best results.
+ */
+ iterations?: number;
+
+ /*
+ * Clustering algorithm.
+ */
+ algorithm?: Algorithm;
+
+ /*
+ * Sum of squared distances to the closest centroid for all samples.
+ */
+ inertia?: number;
+
+ /*
+ * Number of clusters.
+ */
+ k?: number;
+
+ /*
+ * Number of samples.
+ */
+ samples?: number;
+
+ /*
+ * Number of features.
+ */
+ features?: number;
+}
+
+/**
+* Interface describing options when serializing a results object to a string.
+*/
+interface ToStringOptions {
+ /**
+ * Number of digits to display after decimal points. Default: `4`.
+ */
+ digits?: number;
+}
+
+/**
+* Interface describing a results data structure.
+*/
+declare class ResultsStruct {
+ /**
+ * Results constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns results
+ */
+ constructor( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number );
+
+ /*
+ * Number of times the data was clustered with different initial centroids.
+ */
+ replicates: number;
+
+ /*
+ * Index of the initial centroids which produced the best result.
+ */
+ replicate: number;
+
+ /*
+ * Distance metric.
+ */
+ metric: Metric;
+
+ /*
+ * Number of iterations for best results.
+ */
+ iterations: number;
+
+ /*
+ * Clustering algorithm.
+ */
+ algorithm: Algorithm;
+
+ /*
+ * Sum of squared distances to the closest centroid for all samples.
+ */
+ inertia: number;
+
+ /*
+ * Number of clusters.
+ */
+ k: number;
+
+ /*
+ * Number of samples.
+ */
+ samples: number;
+
+ /*
+ * Number of features.
+ */
+ features: number;
+
+ /**
+ * Clustering method.
+ */
+ method: string;
+
+ /**
+ * Serializes a results object as a formatted string.
+ *
+ * @param options - options object
+ * @returns serialized results
+ */
+ toString( options?: ToStringOptions ): string;
+
+ /**
+ * Serializes a results object as a JSON object.
+ *
+ * @returns serialized object
+ */
+ toJSON(): object;
+
+ /**
+ * Returns a DataView of a results object.
+ *
+ * @returns DataView
+ */
+ toDataView(): DataView;
+}
+
+/**
+* Interface defining a results constructor which is both "newable" and "callable".
+*/
+interface ResultsConstructor {
+ /**
+ * Results constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns results object
+ */
+ new( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number ): ResultsStruct;
+
+ /**
+ * Results constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns results object
+ */
+ ( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number ): ResultsStruct;
+}
+
+/**
+* Returns a k-means clustering single-precision floating-point results object.
+*
+* @param arg - buffer or data object
+* @param byteOffset - byte offset
+* @param byteLength - maximum byte length
+* @returns results object
+*
+* @example
+* var results = new Results();
+* // returns
+*
+* results.replicates = 3;
+* results.replicate = 1;
+* results.metric = 'sqeuclidean';
+* results.iterations = 4;
+* results.algorithm = 'lloyd';
+* results.inertia = 3.28;
+* results.k = 4;
+* results.samples = 10;
+* results.features = 3;
+*
+* var str = results.toString();
+* // returns
+*/
+declare var Results: ResultsConstructor;
+
+
+// EXPORTS //
+
+export = Results;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/docs/types/test.ts
new file mode 100644
index 000000000000..eb98df5db33a
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/docs/types/test.ts
@@ -0,0 +1,143 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import Results = require( './index' );
+
+
+// TESTS //
+
+// The constructor returns a results object...
+{
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r0 = new Results( {} ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = new Results( new ArrayBuffer( 80 ) ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = new Results( new ArrayBuffer( 80 ), 8 ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = new Results( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ResultsStruct
+}
+
+// The constructor can be invoked without `new`...
+{
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r0 = Results( {} ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = Results( new ArrayBuffer( 80 ) ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = Results( new ArrayBuffer( 80 ), 8 ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = Results( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ResultsStruct
+}
+
+// The results object has the expected properties...
+{
+ const r = new Results( {} );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.replicates; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.replicate; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.metric; // $ExpectType Metric
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.iterations; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.algorithm; // $ExpectType Algorithm
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.inertia; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.k; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.samples; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.features; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.method; // $ExpectType string
+}
+
+// The compiler throws an error if the constructor is provided a first argument which is not an ArrayBuffer or object...
+{
+ new Results( 'abc' ); // $ExpectError
+ new Results( 123 ); // $ExpectError
+ new Results( true ); // $ExpectError
+ new Results( false ); // $ExpectError
+ new Results( null ); // $ExpectError
+ new Results( [] ); // $ExpectError
+ new Results( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a second argument which is not a number...
+{
+ new Results( new ArrayBuffer( 80 ), 'abc' ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), true ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), false ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), null ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), [] ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), {} ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a third argument which is not a number...
+{
+ new Results( new ArrayBuffer( 80 ), 8, 'abc' ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, true ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, false ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, null ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, [] ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, {} ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, ( x: number ): number => x ); // $ExpectError
+}
+
+// The results object has a `toString` method...
+{
+ const r = new Results( {} );
+
+ r.toString(); // $ExpectType string
+ r.toString( {} ); // $ExpectType string
+ r.toString( { 'digits': 4 } ); // $ExpectType string
+}
+
+// The results object has a `toJSON` method...
+{
+ const r = new Results( {} );
+
+ r.toJSON(); // $ExpectType object
+}
+
+// The results object has a `toDataView` method...
+{
+ const r = new Results( {} );
+
+ r.toDataView(); // $ExpectType DataView
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/examples/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/examples/index.js
new file mode 100644
index 000000000000..8f3a631b1a82
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/examples/index.js
@@ -0,0 +1,38 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var Results = require( './../lib' );
+
+var results = new Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+});
+
+var str = results.toString({
+ 'format': 'linear'
+});
+console.log( str );
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/include/stdlib/ml/base/kmeans/results/float32.h b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/include/stdlib/ml/base/kmeans/results/float32.h
new file mode 100644
index 000000000000..afa869fab856
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/include/stdlib/ml/base/kmeans/results/float32.h
@@ -0,0 +1,57 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef STDLIB_ML_BASE_KMEANS_RESULTS_FLOAT32_H
+#define STDLIB_ML_BASE_KMEANS_RESULTS_FLOAT32_H
+
+#include
+#include
+
+/**
+* Struct for storing kmeans clustering results.
+*/
+struct stdlib_ml_kmeans_float32_results {
+ // Number of times the data was clustered with different initial centroids:
+ int64_t replicates;
+
+ // Index of the initial centroids which produced the best result:
+ int64_t replicate;
+
+ // Distance metric:
+ int8_t metric;
+
+ // Number of iterations for best results:
+ int64_t iterations;
+
+ // Clustering algorithm:
+ int8_t algorithm;
+
+ // Sum of squared distances to the closest centroid for all samples:
+ float inertia;
+
+ // Number of clusters:
+ int64_t k;
+
+ // Number of samples:
+ int64_t samples;
+
+ // Number of features:
+ int64_t features;
+};
+
+#endif // !STDLIB_ML_BASE_KMEANS_RESULTS_FLOAT32_H
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/lib/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/lib/index.js
new file mode 100644
index 000000000000..40b630156477
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/lib/index.js
@@ -0,0 +1,53 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Create a k-means clustering results object.
+*
+* @module @stdlib/ml/base/kmeans/results/float32
+*
+* @example
+* var Results = require( '@stdlib/ml/base/kmeans/results/float32' );
+*
+* var results = new Results();
+* // returns
+*
+* results.replicates = 3;
+* results.replicate = 1;
+* results.metric = 'sqeuclidean';
+* results.iterations = 4;
+* results.algorithm = 'lloyd';
+* results.inertia = 3.28;
+* results.k = 4;
+* results.samples = 10;
+* results.features = 3;
+*
+* var str = results.toString();
+* // returns
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/lib/main.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/lib/main.js
new file mode 100644
index 000000000000..5e00ff5dd1c4
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/lib/main.js
@@ -0,0 +1,62 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var factory = require( '@stdlib/ml/base/kmeans/results/factory' );
+
+
+// MAIN //
+
+/**
+* Returns a k-means clustering single-precision floating-point results object.
+*
+* @name Results
+* @constructor
+* @type {Function}
+* @param {ArrayBuffer} [buffer] - underlying byte buffer
+* @param {NonNegativeInteger} [byteOffset] - byte offset
+* @param {NonNegativeInteger} [byteLength] - maximum byte length
+* @returns {Results} results object
+*
+* @example
+*
+* var results = new Results();
+* // returns
+*
+* results.replicates = 3;
+* results.replicate = 1;
+* results.metric = 'sqeuclidean';
+* results.iterations = 4;
+* results.algorithm = 'lloyd';
+* results.inertia = 3.28;
+* results.k = 4;
+* results.samples = 10;
+* results.features = 3;
+*
+* var str = results.toString();
+* // returns
+*/
+var Results = factory( 'float32' );
+
+
+// EXPORTS //
+
+module.exports = Results;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/manifest.json b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/manifest.json
new file mode 100644
index 000000000000..844d692f6439
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/manifest.json
@@ -0,0 +1,36 @@
+{
+ "options": {},
+ "fields": [
+ {
+ "field": "src",
+ "resolve": true,
+ "relative": true
+ },
+ {
+ "field": "include",
+ "resolve": true,
+ "relative": true
+ },
+ {
+ "field": "libraries",
+ "resolve": false,
+ "relative": false
+ },
+ {
+ "field": "libpath",
+ "resolve": true,
+ "relative": false
+ }
+ ],
+ "confs": [
+ {
+ "src": [],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": []
+ }
+ ]
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/package.json b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/package.json
new file mode 100644
index 000000000000..57715888439f
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/package.json
@@ -0,0 +1,70 @@
+{
+ "name": "@stdlib/ml/base/kmeans/results/float32",
+ "version": "0.0.0",
+ "description": "Create a k-means clustering results object.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "include": "./include",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "ml",
+ "machine-learning",
+ "kmeans",
+ "k-means",
+ "cluster",
+ "clustering",
+ "float",
+ "utilities",
+ "utility",
+ "utils",
+ "util",
+ "constructor",
+ "ctor",
+ "results"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/test/test.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/test/test.js
new file mode 100644
index 000000000000..92042a200d94
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float32/test/test.js
@@ -0,0 +1,505 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var isDataView = require( '@stdlib/assert/is-dataview' );
+var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
+var ArrayBuffer = require( '@stdlib/array/buffer' );
+var f32 = require( '@stdlib/number/float64/base/to-float32' );
+var Number = require( '@stdlib/number/ctor' );
+var Float32Results = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof Float32Results, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ArrayBuffer or data object', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = Float32Results;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ results( value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument which is not a nonnegative integer', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = Float32Results;
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ results( new ArrayBuffer( 1024 ), value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a third argument which is not a nonnegative integer', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = Float32Results;
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ results( new ArrayBuffer( 1024 ), 0, value );
+ };
+ }
+});
+
+tape( 'the function is a constructor which does not require the `new` operator', function test( t ) {
+ var results;
+ var res;
+
+ results = Float32Results;
+
+ res = results();
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( {} );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( new ArrayBuffer( 1024 ) );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( new ArrayBuffer( 1024 ), 0 );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( new ArrayBuffer( 1024 ), 0, 1024 );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object ', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float32Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': f32( 3.28 ),
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ });
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': f32( 3.28 ),
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object (no arguments)', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float32Results();
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = f32( 3.28 );
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': f32( 3.28 ),
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float32Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object (empty object)', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float32Results( {} );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = f32( 3.28 );
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': f32( 3.28 ),
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float32Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object (ArrayBuffer)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float32Results( buf );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = f32( 3.28 );
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': f32( 3.28 ),
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float32Results, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 0, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object (ArrayBuffer, byteOffset)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float32Results( buf, 16 );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = f32( 3.28 );
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': f32( 3.28 ),
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float32Results, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 16, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object (ArrayBuffer, byteOffset, byteLength)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float32Results( buf, 16, 160 );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = f32( 3.28 );
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': f32( 3.28 ),
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float32Results, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 16, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a method property', function test( t ) {
+ var results = new Float32Results();
+
+ t.strictEqual( results.method, 'K-means clustering', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toString` method', function test( t ) {
+ var results;
+ var actual;
+
+ results = new Float32Results();
+
+ actual = results.toString();
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+
+ actual = results.toString({
+ 'decision': false
+ });
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toJSON` method', function test( t ) {
+ var results = new Float32Results();
+ t.strictEqual( typeof results.toJSON, 'function', 'returns expected value' );
+ t.strictEqual( typeof results.toJSON(), 'object', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toDataView` method', function test( t ) {
+ var results = new Float32Results();
+ t.strictEqual( typeof results.toDataView, 'function', 'returns expected value' );
+ t.strictEqual( isDataView( results.toDataView() ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `name` property', function test( t ) {
+ t.strictEqual( typeof Float32Results.name, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has an `alignment` property', function test( t ) {
+ t.strictEqual( typeof Float32Results.alignment, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteLength` property', function test( t ) {
+ t.strictEqual( typeof Float32Results.byteLength, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `fields` property', function test( t ) {
+ t.strictEqual( isStringArray( Float32Results.fields ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `layout` property', function test( t ) {
+ t.strictEqual( typeof Float32Results.layout, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `bufferOf` method', function test( t ) {
+ t.strictEqual( typeof Float32Results.bufferOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteLengthOf` method', function test( t ) {
+ t.strictEqual( typeof Float32Results.byteLengthOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteOffsetOf` method', function test( t ) {
+ t.strictEqual( typeof Float32Results.byteOffsetOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `descriptionOf` method', function test( t ) {
+ t.strictEqual( typeof Float32Results.descriptionOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has an `isStruct` method', function test( t ) {
+ t.strictEqual( typeof Float32Results.isStruct, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `viewOf` method', function test( t ) {
+ t.strictEqual( typeof Float32Results.viewOf, 'function', 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/README.md b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/README.md
new file mode 100644
index 000000000000..2828dc414991
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/README.md
@@ -0,0 +1,431 @@
+
+
+# Float64Results
+
+> Create a k-means clustering double-precision floating-point results object.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+```
+
+#### Float64Results( \[arg\[, byteOffset\[, byteLength]]] )
+
+Returns a k-means clustering double-precision floating-point results object.
+
+```javascript
+var results = new Float64Results();
+// returns {...}
+```
+
+The function supports the following parameters:
+
+- **arg**: an [`ArrayBuffer`][@stdlib/array/buffer] or a data object (_optional_).
+- **byteOffset**: byte offset (_optional_).
+- **byteLength**: maximum byte length (_optional_).
+
+A data object argument is an object having one or more of the following properties:
+
+- **replicates**: number of times the data was clustered with different initial centroids.
+- **replicate**: index of the initial centroids which produced the best result.
+- **metric**: distance metric. (e.g., `'sqeuclidean'`, `'correlation'`, `'cosine'`, or `'cityblock'`).
+- **iterations**: number of iterations for best results.
+- **algorithm**: clustering algorithm. (e.g., `'lloyd'`, or `'elkan'`)
+- **inertia**: sum of squared distances to the closest centroid for all samples.
+- **k**: number of clusters.
+- **samples**: number of samples.
+- **features**: number of features.
+
+#### Float64Results.prototype.replicates
+
+Number of times the data was clustered with different initial centroids.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.replicates );
+// return 0
+```
+
+#### Float64Results.prototype.replicate
+
+Index of the initial centroids which produced the best result.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.replicate );
+// return 0
+```
+
+#### Float64Results.prototype.metric
+
+Distance metric.
+
+```javascript
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = results.metric;
+// returns
+```
+
+#### Float64Results.prototype.iterations
+
+Number of iterations for best results.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.iterations );
+// return 0
+```
+
+#### Float64Results.prototype.algorithm
+
+Clustering algorithm.
+
+```javascript
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = results.algorithm;
+// returns
+```
+
+#### Float64Results.prototype.inertia
+
+Sum of squared distances to the closest centroid for all samples.
+
+```javascript
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = results.inertia;
+// returns
+```
+
+#### Float64Results.prototype.k
+
+Number of clusters.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.k );
+// return 0
+```
+
+#### Float64Results.prototype.samples
+
+Number of samples.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.samples );
+// return 0
+```
+
+#### Float64Results.prototype.features
+
+Number of features.
+
+```javascript
+var Number = require( '@stdlib/number/ctor' );
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = Number( results.features );
+// return 0
+```
+
+#### Float64Results.prototype.toString( \[options] )
+
+Serializes a results object to a formatted string.
+
+```javascript
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = results.toString();
+// returns
+```
+
+The method supports the following options:
+
+- **digits**: number of digits to display after decimal points. Default: `4`.
+
+Example output:
+
+```text
+
+K-means clustering using Lloyd algorithm
+
+ metric used: squared euclidean
+ total replicates: 4
+ best replicate: 2
+ total iterations: 10
+ inertia: 3.2800
+
+Clustering ran for 4 clusters and 10 data samples, each with 3 features
+
+```
+
+#### Float64Results.prototype.toJSON( \[options] )
+
+Serializes a results object as a JSON object.
+
+```javascript
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = results.toJSON();
+// returns {...}
+```
+
+`JSON.stringify()` implicitly calls this method when stringifying a results instance.
+
+#### Float64Results.prototype.toDataView()
+
+Returns a [`DataView`][@stdlib/array/dataview] of a results object.
+
+```javascript
+var results = new Float64Results();
+// returns {...}
+
+// ...
+
+var v = results.toDataView();
+// returns
+```
+
+
+
+
+
+
+
+
+
+## Notes
+
+- A results object is a [`struct`][@stdlib/dstructs/struct] providing a fixed-width composite data structure for storing k-means clustering results and providing an ABI-stable data layout for JavaScript-C interoperation.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Results = require( '@stdlib/ml/base/kmeans/results/float32' );
+
+var results = new Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+});
+
+var str = results.toString({
+ 'format': 'linear'
+});
+console.log( str );
+```
+
+
+
+
+
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/ml/base/kmeans/results/float64.h"
+```
+
+#### stdlib_ml_base_kmeans_float64_results
+
+Structure for holding double-precision floating-point kmeans clustering results.
+
+```c
+#include
+#include
+
+struct stdlib_ml_base_kmeans_float64_results {
+ // Number of times the data was clustered with different initial centroids:
+ int64_t replicates;
+
+ // Index of the initial centroids which produced the best result:
+ int64_t replicate;
+
+ // Distance metric:
+ int8_t metric;
+
+ // Number of iterations for best results:
+ int64_t iterations;
+
+ // Clustering algorithm:
+ int8_t algorithm;
+
+ // Sum of squared distances to the closest centroid for all samples:
+ double inertia;
+
+ // Number of clusters:
+ int64_t k;
+
+ // Number of samples:
+ int64_t samples;
+
+ // Number of features:
+ int64_t features;
+};
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/dstructs/struct]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/dstructs/struct
+
+[@stdlib/array/dataview]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/dataview
+
+[@stdlib/array/buffer]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/buffer
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/benchmark/benchmark.js
new file mode 100644
index 000000000000..4e47102aa3f1
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/benchmark/benchmark.js
@@ -0,0 +1,71 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var isObject = require( '@stdlib/assert/is-object' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var Float64Results = require( './../lib' );
+
+
+// MAIN //
+
+bench( format( '%s::constructor,new', pkg ), function benchmark( b ) {
+ var v;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = new Float64Results();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s::constructor,no_new', pkg ), function benchmark( b ) {
+ var results;
+ var v;
+ var i;
+
+ results = Float64Results;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = results();
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/docs/repl.txt
new file mode 100644
index 000000000000..9d6d92436979
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/docs/repl.txt
@@ -0,0 +1,29 @@
+
+{{alias}}( [arg[, byteOffset[, byteLength]]] )
+ Returns a k-means clustering double-precision floating-point results object.
+
+ Parameters
+ ----------
+ arg: Object|ArrayBuffer (optional)
+ ArrayBuffer or data object.
+
+ byteOffset: integer (optional)
+ Byte offset.
+
+ byteLength: integer (optional)
+ Maximum byte length.
+
+ Returns
+ -------
+ out: Object
+ Results object.
+
+ Examples
+ --------
+ > var r = new {{alias}}();
+ > r.toString()
+
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/docs/types/index.d.ts
new file mode 100644
index 000000000000..f5222fcd3fb0
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/docs/types/index.d.ts
@@ -0,0 +1,233 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+/**
+* Clustering algorithm.
+*/
+type Algorithm = 'lloyd' | 'elkan';
+
+/**
+* Distance metric.
+*/
+type Metric = 'sqeuclidean' | 'correlation' | 'cosine' | 'cityblock';
+
+/**
+* Interface describing clustering results.
+*/
+interface Results {
+ /*
+ * Number of times the data was clustered with different initial centroids.
+ */
+ replicates?: number;
+
+ /*
+ * Index of the initial centroids which produced the best result.
+ */
+ replicate?: number;
+
+ /*
+ * Distance metric.
+ */
+ metric?: Metric;
+
+ /*
+ * Number of iterations for best results.
+ */
+ iterations?: number;
+
+ /*
+ * Clustering algorithm.
+ */
+ algorithm?: Algorithm;
+
+ /*
+ * Sum of squared distances to the closest centroid for all samples.
+ */
+ inertia?: number;
+
+ /*
+ * Number of clusters.
+ */
+ k?: number;
+
+ /*
+ * Number of samples.
+ */
+ samples?: number;
+
+ /*
+ * Number of features.
+ */
+ features?: number;
+}
+
+/**
+* Interface describing options when serializing a results object to a string.
+*/
+interface ToStringOptions {
+ /**
+ * Number of digits to display after decimal points. Default: `4`.
+ */
+ digits?: number;
+}
+
+/**
+* Interface describing a results data structure.
+*/
+declare class ResultsStruct {
+ /**
+ * Results constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns results
+ */
+ constructor( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number );
+
+ /*
+ * Number of times the data was clustered with different initial centroids.
+ */
+ replicates: number;
+
+ /*
+ * Index of the initial centroids which produced the best result.
+ */
+ replicate: number;
+
+ /*
+ * Distance metric.
+ */
+ metric: Metric;
+
+ /*
+ * Number of iterations for best results.
+ */
+ iterations: number;
+
+ /*
+ * Clustering algorithm.
+ */
+ algorithm: Algorithm;
+
+ /*
+ * Sum of squared distances to the closest centroid for all samples.
+ */
+ inertia: number;
+
+ /*
+ * Number of clusters.
+ */
+ k: number;
+
+ /*
+ * Number of samples.
+ */
+ samples: number;
+
+ /*
+ * Number of features.
+ */
+ features: number;
+
+ /**
+ * Clustering method.
+ */
+ method: string;
+
+ /**
+ * Serializes a results object as a formatted string.
+ *
+ * @param options - options object
+ * @returns serialized results
+ */
+ toString( options?: ToStringOptions ): string;
+
+ /**
+ * Serializes a results object as a JSON object.
+ *
+ * @returns serialized object
+ */
+ toJSON(): object;
+
+ /**
+ * Returns a DataView of a results object.
+ *
+ * @returns DataView
+ */
+ toDataView(): DataView;
+}
+
+/**
+* Interface defining a results constructor which is both "newable" and "callable".
+*/
+interface ResultsConstructor {
+ /**
+ * Results constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns results object
+ */
+ new( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number ): ResultsStruct;
+
+ /**
+ * Results constructor.
+ *
+ * @param arg - buffer or data object
+ * @param byteOffset - byte offset
+ * @param byteLength - maximum byte length
+ * @returns results object
+ */
+ ( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number ): ResultsStruct;
+}
+
+/**
+* Returns a k-means clustering double-precision floating-point results object.
+*
+* @param arg - buffer or data object
+* @param byteOffset - byte offset
+* @param byteLength - maximum byte length
+* @returns results object
+*
+* @example
+* var results = new Results();
+* // returns
+*
+* results.replicates = 3;
+* results.replicate = 1;
+* results.metric = 'sqeuclidean';
+* results.iterations = 4;
+* results.algorithm = 'lloyd';
+* results.inertia = 3.28;
+* results.k = 4;
+* results.samples = 10;
+* results.features = 3;
+*
+* var str = results.toString();
+* // returns
+*/
+declare var Results: ResultsConstructor;
+
+
+// EXPORTS //
+
+export = Results;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/docs/types/test.ts
new file mode 100644
index 000000000000..eb98df5db33a
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/docs/types/test.ts
@@ -0,0 +1,143 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import Results = require( './index' );
+
+
+// TESTS //
+
+// The constructor returns a results object...
+{
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r0 = new Results( {} ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = new Results( new ArrayBuffer( 80 ) ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = new Results( new ArrayBuffer( 80 ), 8 ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = new Results( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ResultsStruct
+}
+
+// The constructor can be invoked without `new`...
+{
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r0 = Results( {} ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r1 = Results( new ArrayBuffer( 80 ) ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r2 = Results( new ArrayBuffer( 80 ), 8 ); // $ExpectType ResultsStruct
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const r3 = Results( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ResultsStruct
+}
+
+// The results object has the expected properties...
+{
+ const r = new Results( {} );
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.replicates; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.replicate; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.metric; // $ExpectType Metric
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.iterations; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.algorithm; // $ExpectType Algorithm
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.inertia; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.k; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.samples; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.features; // $ExpectType number
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ r.method; // $ExpectType string
+}
+
+// The compiler throws an error if the constructor is provided a first argument which is not an ArrayBuffer or object...
+{
+ new Results( 'abc' ); // $ExpectError
+ new Results( 123 ); // $ExpectError
+ new Results( true ); // $ExpectError
+ new Results( false ); // $ExpectError
+ new Results( null ); // $ExpectError
+ new Results( [] ); // $ExpectError
+ new Results( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a second argument which is not a number...
+{
+ new Results( new ArrayBuffer( 80 ), 'abc' ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), true ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), false ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), null ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), [] ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), {} ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the constructor is provided a third argument which is not a number...
+{
+ new Results( new ArrayBuffer( 80 ), 8, 'abc' ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, true ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, false ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, null ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, [] ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, {} ); // $ExpectError
+ new Results( new ArrayBuffer( 80 ), 8, ( x: number ): number => x ); // $ExpectError
+}
+
+// The results object has a `toString` method...
+{
+ const r = new Results( {} );
+
+ r.toString(); // $ExpectType string
+ r.toString( {} ); // $ExpectType string
+ r.toString( { 'digits': 4 } ); // $ExpectType string
+}
+
+// The results object has a `toJSON` method...
+{
+ const r = new Results( {} );
+
+ r.toJSON(); // $ExpectType object
+}
+
+// The results object has a `toDataView` method...
+{
+ const r = new Results( {} );
+
+ r.toDataView(); // $ExpectType DataView
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/examples/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/examples/index.js
new file mode 100644
index 000000000000..8f3a631b1a82
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/examples/index.js
@@ -0,0 +1,38 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var Results = require( './../lib' );
+
+var results = new Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+});
+
+var str = results.toString({
+ 'format': 'linear'
+});
+console.log( str );
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/include/stdlib/ml/base/kmeans/results/float64.h b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/include/stdlib/ml/base/kmeans/results/float64.h
new file mode 100644
index 000000000000..d68ac3c7f437
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/include/stdlib/ml/base/kmeans/results/float64.h
@@ -0,0 +1,57 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef STDLIB_ML_BASE_KMEANS_RESULTS_FLOAT64_H
+#define STDLIB_ML_BASE_KMEANS_RESULTS_FLOAT64_H
+
+#include
+#include
+
+/**
+* Struct for storing kmeans clustering results.
+*/
+struct stdlib_ml_base_kmeans_float64_results {
+ // Number of times the data was clustered with different initial centroids:
+ int64_t replicates;
+
+ // Index of the initial centroids which produced the best result:
+ int64_t replicate;
+
+ // Distance metric:
+ int8_t metric;
+
+ // Number of iterations for best results:
+ int64_t iterations;
+
+ // Clustering algorithm:
+ int8_t algorithm;
+
+ // Sum of squared distances to the closest centroid for all samples:
+ double inertia;
+
+ // Number of clusters:
+ int64_t k;
+
+ // Number of samples:
+ int64_t samples;
+
+ // Number of features:
+ int64_t features;
+};
+
+#endif // !STDLIB_ML_BASE_KMEANS_RESULTS_FLOAT64_H
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/lib/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/lib/index.js
new file mode 100644
index 000000000000..196170e09b94
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/lib/index.js
@@ -0,0 +1,53 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Create a k-means clustering double-precision floating-point results object.
+*
+* @module @stdlib/ml/base/kmeans/results/float64
+*
+* @example
+* var Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+*
+* var results = new Results();
+* // returns
+*
+* results.replicates = 3;
+* results.replicate = 1;
+* results.metric = 'sqeuclidean';
+* results.iterations = 4;
+* results.algorithm = 'lloyd';
+* results.inertia = 3.28;
+* results.k = 4;
+* results.samples = 10;
+* results.features = 3;
+*
+* var str = results.toString();
+* // returns
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/lib/main.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/lib/main.js
new file mode 100644
index 000000000000..9a5d19d63e4f
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/lib/main.js
@@ -0,0 +1,62 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var factory = require( '@stdlib/ml/base/kmeans/results/factory' );
+
+
+// MAIN //
+
+/**
+* Returns a k-means clustering double-precision floating-point results object.
+*
+* @name Results
+* @constructor
+* @type {Function}
+* @param {ArrayBuffer} [buffer] - underlying byte buffer
+* @param {NonNegativeInteger} [byteOffset] - byte offset
+* @param {NonNegativeInteger} [byteLength] - maximum byte length
+* @returns {Results} results object
+*
+* @example
+*
+* var results = new Results();
+* // returns
+*
+* results.replicates = 3;
+* results.replicate = 1;
+* results.metric = 'sqeuclidean';
+* results.iterations = 4;
+* results.algorithm = 'lloyd';
+* results.inertia = 3.28;
+* results.k = 4;
+* results.samples = 10;
+* results.features = 3;
+*
+* var str = results.toString();
+* // returns
+*/
+var Results = factory( 'float64' );
+
+
+// EXPORTS //
+
+module.exports = Results;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/manifest.json b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/manifest.json
new file mode 100644
index 000000000000..844d692f6439
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/manifest.json
@@ -0,0 +1,36 @@
+{
+ "options": {},
+ "fields": [
+ {
+ "field": "src",
+ "resolve": true,
+ "relative": true
+ },
+ {
+ "field": "include",
+ "resolve": true,
+ "relative": true
+ },
+ {
+ "field": "libraries",
+ "resolve": false,
+ "relative": false
+ },
+ {
+ "field": "libpath",
+ "resolve": true,
+ "relative": false
+ }
+ ],
+ "confs": [
+ {
+ "src": [],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": []
+ }
+ ]
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/package.json b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/package.json
new file mode 100644
index 000000000000..f8a7b2d63c92
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/package.json
@@ -0,0 +1,70 @@
+{
+ "name": "@stdlib/ml/base/kmeans/results/float64",
+ "version": "0.0.0",
+ "description": "Create a k-means clustering double-precision floating-point results object.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "include": "./include",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "ml",
+ "machine-learning",
+ "kmeans",
+ "k-means",
+ "cluster",
+ "clustering",
+ "double",
+ "utilities",
+ "utility",
+ "utils",
+ "util",
+ "constructor",
+ "ctor",
+ "results"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/test/test.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/test/test.js
new file mode 100644
index 000000000000..75bc55685b07
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/float64/test/test.js
@@ -0,0 +1,505 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var Number = require( '@stdlib/number/ctor' );
+var isDataView = require( '@stdlib/assert/is-dataview' );
+var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
+var ArrayBuffer = require( '@stdlib/array/buffer' );
+var Float64Results = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof Float64Results, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ArrayBuffer or data object', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = Float64Results;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ results( value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument which is not a nonnegative integer', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = Float64Results;
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ results( new ArrayBuffer( 1024 ), value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a third argument which is not a nonnegative integer', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = Float64Results;
+
+ values = [
+ '5',
+ -5,
+ 3.14,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ results( new ArrayBuffer( 1024 ), 0, value );
+ };
+ }
+});
+
+tape( 'the function is a constructor which does not require the `new` operator', function test( t ) {
+ var results;
+ var res;
+
+ results = Float64Results;
+
+ res = results();
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( {} );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( new ArrayBuffer( 1024 ) );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( new ArrayBuffer( 1024 ), 0 );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ res = results( new ArrayBuffer( 1024 ), 0, 1024 );
+ t.strictEqual( res instanceof results, true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object ', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float64Results({
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ });
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float64Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object (no arguments)', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float64Results();
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = 3.28;
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float64Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object (empty object)', function test( t ) {
+ var expected;
+ var actual;
+
+ actual = new Float64Results( {} );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = 3.28;
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float64Results, true, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object (ArrayBuffer)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float64Results( buf );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = 3.28;
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float64Results, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 0, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object (ArrayBuffer, byteOffset)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float64Results( buf, 16 );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = 3.28;
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float64Results, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 16, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function is a constructor for a fixed-width results object (ArrayBuffer, byteOffset, byteLength)', function test( t ) {
+ var expected;
+ var actual;
+ var buf;
+
+ buf = new ArrayBuffer( 1024 );
+ actual = new Float64Results( buf, 16, 160 );
+
+ actual.replicates = 4;
+ actual.replicate = 2;
+ actual.metric = 'sqeuclidean';
+ actual.iterations = 10;
+ actual.algorithm = 'lloyd';
+ actual.inertia = 3.28;
+ actual.k = 4;
+ actual.samples = 10;
+ actual.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3
+ };
+
+ t.strictEqual( actual instanceof Float64Results, true, 'returns expected value' );
+ t.strictEqual( actual.toDataView().buffer, buf, 'returns expected value' );
+ t.strictEqual( actual.toDataView().byteOffset, 16, 'returns expected value' );
+ t.strictEqual( Number( actual.replicates ), expected.replicates, 'returns expected value' );
+ t.strictEqual( Number( actual.replicate ), expected.replicate, 'returns expected value' );
+ t.strictEqual( actual.metric, expected.metric, 'returns expected value' );
+ t.strictEqual( Number( actual.iterations ), expected.iterations, 'returns expected value' );
+ t.strictEqual( actual.algorithm, expected.algorithm, 'returns expected value' );
+ t.strictEqual( actual.inertia, expected.inertia, 'returns expected value' );
+ t.strictEqual( Number( actual.k ), expected.k, 'returns expected value' );
+ t.strictEqual( Number( actual.samples ), expected.samples, 'returns expected value' );
+ t.strictEqual( Number( actual.features ), expected.features, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a method property', function test( t ) {
+ var results = new Float64Results();
+
+ t.strictEqual( results.method, 'K-means clustering', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toString` method', function test( t ) {
+ var results;
+ var actual;
+
+ results = new Float64Results();
+
+ actual = results.toString();
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+
+ actual = results.toString({
+ 'decision': false
+ });
+ t.strictEqual( typeof actual, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toJSON` method', function test( t ) {
+ var results = new Float64Results();
+ t.strictEqual( typeof results.toJSON, 'function', 'returns expected value' );
+ t.strictEqual( typeof results.toJSON(), 'object', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor returns an instance having a `toDataView` method', function test( t ) {
+ var results = new Float64Results();
+ t.strictEqual( typeof results.toDataView, 'function', 'returns expected value' );
+ t.strictEqual( isDataView( results.toDataView() ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `name` property', function test( t ) {
+ t.strictEqual( typeof Float64Results.name, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has an `alignment` property', function test( t ) {
+ t.strictEqual( typeof Float64Results.alignment, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteLength` property', function test( t ) {
+ t.strictEqual( typeof Float64Results.byteLength, 'number', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `fields` property', function test( t ) {
+ t.strictEqual( isStringArray( Float64Results.fields ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `layout` property', function test( t ) {
+ t.strictEqual( typeof Float64Results.layout, 'string', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `bufferOf` method', function test( t ) {
+ t.strictEqual( typeof Float64Results.bufferOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteLengthOf` method', function test( t ) {
+ t.strictEqual( typeof Float64Results.byteLengthOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `byteOffsetOf` method', function test( t ) {
+ t.strictEqual( typeof Float64Results.byteOffsetOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `descriptionOf` method', function test( t ) {
+ t.strictEqual( typeof Float64Results.descriptionOf, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has an `isStruct` method', function test( t ) {
+ t.strictEqual( typeof Float64Results.isStruct, 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the constructor has a `viewOf` method', function test( t ) {
+ t.strictEqual( typeof Float64Results.viewOf, 'function', 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/README.md b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/README.md
new file mode 100644
index 000000000000..9bc81b4450e0
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/README.md
@@ -0,0 +1,129 @@
+
+
+# res2json
+
+> Serialize a k-means clustering results object as a JSON object.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var res2json = require( '@stdlib/ml/base/kmeans/results/to-json' );
+```
+
+#### res2json( results )
+
+Serializes a k-means clustering results object as a JSON object.
+
+```javascript
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+
+var results = new Float64Results();
+
+// ...
+
+var o = res2json( results );
+// returns {...}
+```
+
+The function supports the following parameters:
+
+- **results**: k-means clustering results object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+var algorithmResolveEnum = require( '@stdlib/ml/base/kmeans/algorithm-resolve-enum' );
+var metricResolveEnum = require( '@stdlib/ml/base/kmeans/metric-resolve-enum' );
+var res2json = require( '@stdlib/ml/base/kmeans/results/to-json' );
+
+var results = new Float64Results();
+results.replicates = 4;
+results.replicate = 2;
+results.metric = metricResolveEnum( 'sqeuclidean' );
+results.iterations = 10;
+results.algorithm = algorithmResolveEnum( 'lloyd' );
+results.inertia = 3.28;
+results.k = 4;
+results.samples = 10;
+results.features = 3;
+
+var o = res2json( results );
+console.log( o );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/benchmark/benchmark.js
new file mode 100644
index 000000000000..49f5e6f4e32f
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/benchmark/benchmark.js
@@ -0,0 +1,56 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+var Float32Results = require( '@stdlib/ml/base/kmeans/results/float32' );
+var isPlainObject = require( '@stdlib/assert/is-plain-object' );
+var pkg = require( './../package.json' ).name;
+var res2json = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ new Float64Results(),
+ new Float32Results()
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = res2json( values[ i%values.length ] );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an object' );
+ }
+ }
+ b.toc();
+ if ( !isPlainObject( v ) ) {
+ b.fail( 'should return an object' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/docs/repl.txt
new file mode 100644
index 000000000000..571422bcad9f
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/docs/repl.txt
@@ -0,0 +1,34 @@
+
+{{alias}}( results )
+ Serializes a k-means clustering results object as a JSON object.
+
+ Parameters
+ ----------
+ results: Object
+ K-means clustering results object.
+
+ Returns
+ -------
+ out: Object
+ Serialized object.
+
+ Examples
+ --------
+ > var res = {
+ ... 'replicates': 4,
+ ... 'replicate': 2,
+ ... 'metric': 'sqeuclidean',
+ ... 'iterations': 10,
+ ... 'algorithm': 'lloyd',
+ ... 'inertia': 3.28,
+ ... 'k': 4,
+ ... 'samples': 10,
+ ... 'features': 3,
+ ... 'method': 'K-means clustering'
+ ... };
+ > var o = {{alias}}( res )
+ {...}
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/docs/types/index.d.ts
new file mode 100644
index 000000000000..305d4d980c8d
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/docs/types/index.d.ts
@@ -0,0 +1,105 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+/**
+* Interface describing a results object.
+*/
+interface Results {
+ /**
+ * Number of times the data was clustered with different initial centroids.
+ */
+ replicates: number;
+
+ /**
+ * Index of the initial centroids which produced the best result.
+ */
+ replicate: number;
+
+ /**
+ * Distance metric.
+ */
+ metric: string;
+
+ /**
+ * Number of iterations for best results.
+ */
+ iterations: number;
+
+ /**
+ * Clustering algorithm.
+ */
+ algorithm: string;
+
+ /**
+ * Sum of squared distances to the closest centroid for all samples.
+ */
+ inertia: number;
+
+ /**
+ * Number of clusters.
+ */
+ k: number;
+
+ /**
+ * Number of samples.
+ */
+ samples: number;
+
+ /**
+ * Number of features.
+ */
+ features: number;
+
+ /**
+ * Clustering method.
+ */
+ method: string;
+}
+
+/**
+* Serializes a k-means clustering results object as a JSON object.
+*
+* @param results - k-means clustering results object
+* @returns serialized object
+*
+* @example
+*
+* var results = {
+* 'replicates': 4,
+* 'replicate': 2,
+* 'metric': 'sqeuclidean',
+* 'iterations': 10,
+* 'algorithm': 'lloyd',
+* 'inertia': 3.28,
+* 'k': 4,
+* 'samples': 10,
+* 'features': 3,
+* 'method': 'K-means clustering'
+* };
+*
+* var obj = res2json( results );
+* // returns {...}
+*/
+declare function res2json( results: Results ): Results;
+
+
+// EXPORTS //
+
+export = res2json;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/docs/types/test.ts
new file mode 100644
index 000000000000..3cbd9c159084
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/docs/types/test.ts
@@ -0,0 +1,51 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import res2json = require( './index' );
+
+
+// TESTS //
+
+// The function returns an object...
+{
+ var res = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3,
+ 'method': 'K-means clustering'
+ };
+ res2json( res ); // $ExpectType Results
+}
+
+// The compiler throws an error if not provided a results object...
+{
+ res2json( 10 ); // $ExpectError
+ res2json( true ); // $ExpectError
+ res2json( false ); // $ExpectError
+ res2json( null ); // $ExpectError
+ res2json( undefined ); // $ExpectError
+ res2json( [] ); // $ExpectError
+ res2json( {} ); // $ExpectError
+ res2json( ( x: number ): number => x ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/examples/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/examples/index.js
new file mode 100644
index 000000000000..df18c55d60dc
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/examples/index.js
@@ -0,0 +1,38 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+var algorithmResolveEnum = require( '@stdlib/ml/base/kmeans/algorithm-resolve-enum' );
+var metricResolveEnum = require( '@stdlib/ml/base/kmeans/metric-resolve-enum' );
+var res2json = require( './../lib' );
+
+var results = new Float64Results();
+results.replicates = 4;
+results.replicate = 2;
+results.metric = metricResolveEnum( 'sqeuclidean' );
+results.iterations = 10;
+results.algorithm = algorithmResolveEnum( 'lloyd' );
+results.inertia = 3.28;
+results.k = 4;
+results.samples = 10;
+results.features = 3;
+
+var o = res2json( results );
+console.log( o );
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/lib/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/lib/index.js
new file mode 100644
index 000000000000..8187d1082ca3
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/lib/index.js
@@ -0,0 +1,53 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Serialize a k-means clustering results object as a JSON object.
+*
+* @module @stdlib/ml/base/kmeans/results/to-json
+*
+* @example
+* var res2json = require( '@stdlib/ml/base/kmeans/results/to-json' );
+*
+* var results = {
+* 'replicates': 4,
+* 'replicate': 2,
+* 'metric': 'sqeuclidean',
+* 'iterations': 10,
+* 'algorithm': 'lloyd',
+* 'inertia': 3.28,
+* 'k': 4,
+* 'samples': 10,
+* 'features': 3,
+* 'method': 'K-means clustering'
+* };
+*
+* var obj = res2json( results );
+* // returns {...}
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/lib/main.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/lib/main.js
new file mode 100644
index 000000000000..275001489dda
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/lib/main.js
@@ -0,0 +1,68 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+
+// MAIN //
+
+/**
+* Serializes a k-means clustering results object as a JSON object.
+*
+* @param {Object} results - k-means clustering results object
+* @returns {Object} serialized object
+*
+* @example
+*
+* var results = {
+* 'replicates': 4,
+* 'replicate': 2,
+* 'metric': 'sqeuclidean',
+* 'iterations': 10,
+* 'algorithm': 'lloyd',
+* 'inertia': 3.28,
+* 'k': 4,
+* 'samples': 10,
+* 'features': 3,
+* 'method': 'K-means clustering'
+* };
+*
+* var obj = toJSON( results );
+* // returns {...}
+*/
+function toJSON( results ) {
+ return {
+ 'replicates': results.replicates,
+ 'replicate': results.replicate,
+ 'metric': results.metric,
+ 'iterations': results.iterations,
+ 'algorithm': results.algorithm,
+ 'inertia': results.inertia,
+ 'k': results.k,
+ 'samples': results.samples,
+ 'features': results.features,
+ 'method': results.method
+ };
+}
+
+
+// EXPORTS //
+
+module.exports = toJSON;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/package.json b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/package.json
new file mode 100644
index 000000000000..f84d7360a8be
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/package.json
@@ -0,0 +1,66 @@
+{
+ "name": "@stdlib/ml/base/kmeans/results/to-json",
+ "version": "0.0.0",
+ "description": "Serialize a k-means clustering results object as a JSON object.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "ml",
+ "machine learning",
+ "kmeans",
+ "k-means",
+ "cluster",
+ "clustering",
+ "utilities",
+ "utility",
+ "utils",
+ "util",
+ "json"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/test/test.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/test/test.js
new file mode 100644
index 000000000000..ddb121ddae26
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-json/test/test.js
@@ -0,0 +1,70 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+var algorithmResolveEnum = require( '@stdlib/ml/base/kmeans/algorithm-resolve-enum' );
+var metricResolveEnum = require( '@stdlib/ml/base/kmeans/metric-resolve-enum' );
+var res2json = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof res2json, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function serializes a results object to JSON', function test( t ) {
+ var expected;
+ var actual;
+ var value;
+
+ value = new Float64Results();
+ value.replicates = 4;
+ value.replicate = 2;
+ value.metric = metricResolveEnum( 'sqeuclidean' );
+ value.iterations = 10;
+ value.algorithm = algorithmResolveEnum( 'lloyd' );
+ value.inertia = 3.28;
+ value.k = 4;
+ value.samples = 10;
+ value.features = 3;
+
+ expected = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3,
+ 'method': 'K-means clustering'
+ };
+
+ actual = res2json( value );
+ t.deepEqual( actual, expected, 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/README.md b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/README.md
new file mode 100644
index 000000000000..a0ff1ed8ad4a
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/README.md
@@ -0,0 +1,150 @@
+
+
+# res2str
+
+> Serialize a k-means clustering results object as a formatted string.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var res2str = require( '@stdlib/ml/base/kmeans/results/to-string' );
+```
+
+#### res2str( results\[, options] )
+
+Serializes a k-means clustering results object as a formatted string.
+
+```javascript
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+
+var results = new Float64Results();
+
+// ...
+
+var s = res2str( results );
+// returns
+```
+
+The function supports the following parameters:
+
+- **results**: k-means clustering results object.
+- **options**: function options.
+
+The function supports the following options:
+
+- **digits**: number of digits to display after decimal points. Default: `4`.
+
+
+
+
+
+
+
+
+
+## Notes
+
+- Example output:
+
+ ```text
+
+ K-means clustering using Lloyd algorithm
+
+ metric used: squared euclidean
+ total replicates: 4
+ best replicate: 2
+ total iterations: 10
+ inertia: 3.2800
+
+ Clustering ran for 4 clusters and 10 data samples, each with 3 features
+
+ ```
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+var res2str = require( '@stdlib/ml/base/kmeans/results/to-string' );
+
+var results = new Float64Results();
+results.k = 4;
+results.samples = 10;
+results.features = 3;
+results.metric = 'sqeuclidean';
+results.algorithm = 'lloyd';
+results.replicates = 4;
+results.replicate = 2;
+results.iterations = 10;
+results.inertia = 3.28;
+
+var s = res2str( results );
+console.log( s );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/benchmark/benchmark.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/benchmark/benchmark.js
new file mode 100644
index 000000000000..e8a397958455
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/benchmark/benchmark.js
@@ -0,0 +1,56 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+var Float32Results = require( '@stdlib/ml/base/kmeans/results/float32' );
+var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
+var pkg = require( './../package.json' ).name;
+var res2str = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var values;
+ var v;
+ var i;
+
+ values = [
+ new Float64Results(),
+ new Float32Results()
+ ];
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = res2str( values[ i%values.length ] );
+ if ( typeof v !== 'string' ) {
+ b.fail( 'should return a string' );
+ }
+ }
+ b.toc();
+ if ( !isString( v ) ) {
+ b.fail( 'should return a string' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/docs/repl.txt b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/docs/repl.txt
new file mode 100644
index 000000000000..4abcb0e6c6af
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/docs/repl.txt
@@ -0,0 +1,40 @@
+
+{{alias}}( results[, options] )
+ Serializes a k-means clustering results object as a formatted string.
+
+ Parameters
+ ----------
+ results: Object
+ K-means clustering results object.
+
+ options: Object (optional)
+ Function options.
+
+ options.digits: number (optional)
+ Number of digits to display after decimal points. Default: 4.
+
+ Returns
+ -------
+ out: string
+ Serialized results.
+
+ Examples
+ --------
+ > var res = {
+ ... 'replicates': 4,
+ ... 'replicate': 2,
+ ... 'metric': 'sqeuclidean',
+ ... 'iterations': 10,
+ ... 'algorithm': 'lloyd',
+ ... 'inertia': 3.28,
+ ... 'k': 4,
+ ... 'samples': 10,
+ ... 'features': 3,
+ ... 'method': 'K-means clustering'
+ ... };
+ > var s = {{alias}}( res )
+
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/docs/types/index.d.ts b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/docs/types/index.d.ts
new file mode 100644
index 000000000000..9272e36c9677
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/docs/types/index.d.ts
@@ -0,0 +1,134 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+/**
+* Interface describing a results object.
+*/
+interface Results {
+ /**
+ * Number of times the data was clustered with different initial centroids.
+ */
+ replicates: number;
+
+ /**
+ * Index of the initial centroids which produced the best result.
+ */
+ replicate: number;
+
+ /**
+ * Distance metric.
+ */
+ metric: string;
+
+ /**
+ * Number of iterations for best results.
+ */
+ iterations: number;
+
+ /**
+ * Clustering algorithm.
+ */
+ algorithm: string;
+
+ /**
+ * Sum of squared distances to the closest centroid for all samples.
+ */
+ inertia: number;
+
+ /**
+ * Number of clusters.
+ */
+ k: number;
+
+ /**
+ * Number of samples.
+ */
+ samples: number;
+
+ /**
+ * Number of features.
+ */
+ features: number;
+
+ /**
+ * Clustering method.
+ */
+ method: string;
+}
+
+/**
+* Interface describing function options.
+*/
+interface Options {
+ /**
+ * Number of digits to display after decimal points. Default: 4.
+ */
+ digits?: number;
+}
+
+/**
+* Serializes a k-means clustering results object as a formatted string.
+*
+* ## Notes
+*
+* - Example output:
+*
+* ```text
+*
+* K-means clustering using Lloyd algorithm
+*
+* metric used: squared euclidean
+* total replicates: 4
+* best replicate: 2
+* total iterations: 10
+* inertia: 3.2800
+*
+* Clustering ran for 4 clusters and 10 data samples, each with 3 features
+*
+* ```
+*
+* @param results - k-means clustering results object
+* @param options - options object
+* @param options.digits - number of digits to display after decimal points
+* @returns serialized results
+*
+* @example
+* var results = {
+* 'replicates': 4,
+* 'replicate': 2,
+* 'metric': 'sqeuclidean',
+* 'iterations': 10,
+* 'algorithm': 'lloyd',
+* 'inertia': 3.28,
+* 'k': 4,
+* 'samples': 10,
+* 'features': 3,
+* 'method': 'K-means clustering'
+* };
+*
+* var str = res2str( results );
+* // returns
+*/
+declare function res2str( results: Results, options?: Options ): string;
+
+
+// EXPORTS //
+
+export = res2str;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/docs/types/test.ts b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/docs/types/test.ts
new file mode 100644
index 000000000000..c956ad0fdb61
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/docs/types/test.ts
@@ -0,0 +1,111 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import res2str = require( './index' );
+
+
+// TESTS //
+
+// The function returns a string...
+{
+ var res = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3,
+ 'method': 'K-means clustering'
+ };
+ res2str( res ); // $ExpectType string
+ res2str( res, {} ); // $ExpectType string
+}
+
+// The compiler throws an error if provided first argument which is not a results object...
+{
+ res2str( '10' ); // $ExpectError
+ res2str( 10 ); // $ExpectError
+ res2str( true ); // $ExpectError
+ res2str( false ); // $ExpectError
+ res2str( null ); // $ExpectError
+ res2str( undefined ); // $ExpectError
+ res2str( [] ); // $ExpectError
+ res2str( {} ); // $ExpectError
+ res2str( ( x: number ): number => x ); // $ExpectError
+
+ res2str( '10', {} ); // $ExpectError
+ res2str( 10, {} ); // $ExpectError
+ res2str( true, {} ); // $ExpectError
+ res2str( false, {} ); // $ExpectError
+ res2str( null, {} ); // $ExpectError
+ res2str( undefined, {} ); // $ExpectError
+ res2str( [], {} ); // $ExpectError
+ res2str( {}, {} ); // $ExpectError
+ res2str( ( x: number ): number => x, {} ); // $ExpectError
+}
+
+// The compiler throws an error if provided a second argument which is not an object...
+{
+ var res = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3,
+ 'method': 'K-means clustering'
+ };
+
+ res2str( res, '10' ); // $ExpectError
+ res2str( res, 10 ); // $ExpectError
+ res2str( res, true ); // $ExpectError
+ res2str( res, false ); // $ExpectError
+ res2str( res, null ); // $ExpectError
+ res2str( res, [] ); // $ExpectError
+ res2str( res, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if provided a `digits` option which is not a number...
+{
+ var res = {
+ 'replicates': 4,
+ 'replicate': 2,
+ 'metric': 'sqeuclidean',
+ 'iterations': 10,
+ 'algorithm': 'lloyd',
+ 'inertia': 3.28,
+ 'k': 4,
+ 'samples': 10,
+ 'features': 3,
+ 'method': 'K-means clustering'
+ };
+
+ res2str( res, { 'digits': '10' } ); // $ExpectError
+ res2str( res, { 'digits': true } ); // $ExpectError
+ res2str( res, { 'digits': false } ); // $ExpectError
+ res2str( res, { 'digits': null } ); // $ExpectError
+ res2str( res, { 'digits': [] } ); // $ExpectError
+ res2str( res, { 'digits': {} } ); // $ExpectError
+ res2str( res, { 'digits': ( x: number ): number => x } ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/examples/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/examples/index.js
new file mode 100644
index 000000000000..5d013aca01fd
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/examples/index.js
@@ -0,0 +1,36 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+var res2str = require( './../lib' );
+
+var results = new Float64Results();
+results.k = 4;
+results.samples = 10;
+results.features = 3;
+results.metric = 'sqeuclidean';
+results.algorithm = 'lloyd';
+results.replicates = 4;
+results.replicate = 2;
+results.iterations = 10;
+results.inertia = 3.28;
+
+var s = res2str( results );
+console.log( s );
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/lib/index.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/lib/index.js
new file mode 100644
index 000000000000..b4e755d0fdd9
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/lib/index.js
@@ -0,0 +1,53 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Serialize a k-means clustering results object as a formatted string.
+*
+* @module @stdlib/ml/base/kmeans/results/to-string
+*
+* @example
+* var res2str = require( '@stdlib/ml/base/kmeans/results/to-string' );
+*
+* var results = {
+* 'replicates': 4,
+* 'replicate': 2,
+* 'metric': 'sqeuclidean',
+* 'iterations': 10,
+* 'algorithm': 'lloyd',
+* 'inertia': 3.28,
+* 'k': 4,
+* 'samples': 10,
+* 'features': 3,
+* 'method': 'K-means clustering'
+* };
+*
+* var str = res2str( results );
+* // returns
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/lib/main.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/lib/main.js
new file mode 100644
index 000000000000..ab610b260c88
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/lib/main.js
@@ -0,0 +1,123 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' );
+var isObject = require( '@stdlib/assert/is-plain-object' );
+var startcase = require( '@stdlib/string/base/startcase' );
+var hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var format = require( '@stdlib/string/format' );
+
+
+// MAIN //
+
+/**
+* Serializes a k-means clustering results object as a formatted string.
+*
+* ## Notes
+*
+* - Example output:
+*
+* ```text
+*
+* K-means clustering using Lloyd algorithm
+*
+* metric used: squared euclidean
+* total replicates: 4
+* best replicate: 2
+* total iterations: 10
+* inertia: 3.2800
+*
+* Clustering ran for 4 clusters and 10 data samples, each with 3 features
+*
+* ```
+*
+* @param {Object} results - k-means clustering results object
+* @param {Options} [opts] - options object
+* @param {PositiveInteger} [opts.digits=4] - number of digits to display after decimal points
+* @throws {TypeError} options argument must be an object
+* @throws {TypeError} must provide valid options
+* @returns {string} serialized results
+*
+* @example
+* var results = {
+* 'replicates': 4,
+* 'replicate': 2,
+* 'metric': 'sqeuclidean',
+* 'iterations': 10,
+* 'algorithm': 'lloyd',
+* 'inertia': 3.28,
+* 'k': 4,
+* 'samples': 10,
+* 'features': 3,
+* 'method': 'K-means clustering'
+* };
+*
+* var str = toString( results );
+* // returns
+*/
+function toString( results, opts ) { // eslint-disable-line stdlib/no-redeclare
+ var metric;
+ var dgts;
+ var out;
+
+ dgts = 4;
+ if ( arguments.length > 1 ) {
+ if ( !isObject( opts ) ) {
+ throw new TypeError( format( 'invalid argument. Must provide an object. Value: `%s`.', opts ) );
+ }
+ if ( hasOwnProp( opts, 'digits' ) ) {
+ if ( !isPositiveInteger( opts.digits ) ) {
+ throw new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'digits', opts.digits ) );
+ }
+ dgts = opts.digits;
+ }
+ }
+
+ if ( results.metric === 'sqeuclidean' ) {
+ metric = 'squared euclidean';
+ } else if ( results.metric === 'cityblock' ) {
+ metric = 'cityblock';
+ } else if ( results.metric === 'correlation' ) {
+ metric = 'correlation';
+ } else {
+ metric = 'cosine';
+ }
+
+ out = [
+ '',
+ format( '%s using %s algorithm', results.method, startcase( results.algorithm ) ),
+ '',
+ format( ' metric used: %s', metric ),
+ format( ' total replicates: %u', results.replicates ),
+ format( ' best replicate: %u', results.replicate ),
+ format( ' total iterations: %u', results.iterations ),
+ format( ' inertia: %0.'+dgts+'f', results.inertia ),
+ '',
+ format( 'Clustering ran for %u clusters and %u data samples, each with %u features', results.k, results.samples, results.features )
+ ];
+ return out.join( '\n' );
+}
+
+
+// EXPORTS //
+
+module.exports = toString;
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/package.json b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/package.json
new file mode 100644
index 000000000000..8380f3fa89ae
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/package.json
@@ -0,0 +1,66 @@
+{
+ "name": "@stdlib/ml/base/kmeans/results/to-string",
+ "version": "0.0.0",
+ "description": "Serialize a k-means clustering results object as a formatted string.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "ml",
+ "machine-learning",
+ "kmeans",
+ "k-means",
+ "cluster",
+ "clustering",
+ "utilities",
+ "utility",
+ "utils",
+ "util",
+ "string"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/test/test.js b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/test/test.js
new file mode 100644
index 000000000000..211bcca82dcb
--- /dev/null
+++ b/lib/node_modules/@stdlib/ml/base/kmeans/results/to-string/test/test.js
@@ -0,0 +1,172 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
+var Float64Results = require( '@stdlib/ml/base/kmeans/results/float64' );
+var res2str = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof res2str, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a second argument which is not an object', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = new Float64Results();
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ res2str( results, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `digits` option which is not a positive integer', function test( t ) {
+ var results;
+ var values;
+ var i;
+
+ results = new Float64Results();
+
+ values = [
+ '5',
+ -5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ res2str( results, {
+ 'digits': value
+ });
+ };
+ }
+});
+
+tape( 'the function serializes a results object to a string', function test( t ) {
+ var expected;
+ var actual;
+ var value;
+
+ value = new Float64Results();
+ value.k = 4;
+ value.samples = 10;
+ value.features = 3;
+ value.metric = 'sqeuclidean';
+ value.algorithm = 'lloyd';
+ value.replicates = 4;
+ value.replicate = 2;
+ value.iterations = 10;
+ value.inertia = 3.28;
+
+ actual = res2str( value );
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'K-means clustering using Lloyd algorithm',
+ '',
+ ' metric used: squared euclidean',
+ ' total replicates: 4',
+ ' best replicate: 2',
+ ' total iterations: 10',
+ ' inertia: 3.2800',
+ '',
+ 'Clustering ran for 4 clusters and 10 data samples, each with 3 features'
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying the number of displayed digits (digits=2)', function test( t ) {
+ var expected;
+ var actual;
+ var value;
+
+ value = new Float64Results();
+ value.k = 4;
+ value.samples = 10;
+ value.features = 3;
+ value.metric = 'sqeuclidean';
+ value.algorithm = 'lloyd';
+ value.replicates = 4;
+ value.replicate = 2;
+ value.iterations = 10;
+ value.inertia = 3.28;
+
+ actual = res2str( value, {
+ 'digits': 2
+ });
+ t.strictEqual( isString( actual ), true, 'returns expected value' );
+
+ expected = [
+ '',
+ 'K-means clustering using Lloyd algorithm',
+ '',
+ ' metric used: squared euclidean',
+ ' total replicates: 4',
+ ' best replicate: 2',
+ ' total iterations: 10',
+ ' inertia: 3.28',
+ '',
+ 'Clustering ran for 4 clusters and 10 data samples, each with 3 features'
+ ].join( '\n' );
+ t.strictEqual( actual, expected, 'returns expected value' );
+
+ t.end();
+});