/* harmony default export */

/* harmony export (binding) */

/* harmony import */

/*#__PURE__*/

/**
 * FUNCTION: partial( fn, j )
 *	Partially applied function from the right.
 *
 * @private
 * @param {Function} fn - input function
 * @param {Number} j - array index
 * @returns {Function} partially applied function
 */

/**
 * Insert a new element to the queue. Elements are assumed to be objects with `sim` and `index` properties.
 */

/**
*
*	COMPUTE: argmax
*
*
*	DESCRIPTION:
*		- Computes the maximum value of a numeric array and returns the corresponding array indices.
*
*
*	NOTES:
*		[1]
*
*
*	TODO:
*		[1]
*
*
*	LICENSE:
*		MIT
*
*	Copyright (c) 2014. Athan Reines.
*
*
*	AUTHOR:
*		Athan Reines. kgryte@gmail.com. 2014.
*
*/

/**
*
*	VALIDATE: function
*
*
*	DESCRIPTION:
*		- Validates if a value is a function.
*
*
*	NOTES:
*		[1]
*
*
*	TODO:
*		[1]
*
*
*	LICENSE:
*		MIT
*
*	Copyright (c) 2014. Athan Reines.
*
*
*	AUTHOR:
*		Athan Reines. kgryte@gmail.com. 2014.
*
*/

/**
*
*	VALIDATE: string
*
*
*	DESCRIPTION:
*		- Validates if a value is a string.
*
*
*	NOTES:
*		[1]
*
*
*	TODO:
*		[1]
*
*
*	LICENSE:
*		MIT
*
*	Copyright (c) 2014. Athan Reines.
*
*
*	AUTHOR:
*		Athan Reines. kgryte@gmail.com. 2014.
*
*/

/**
* @license Apache-2.0
*
* Copyright (c) 2018 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.
*/

/**
* Algorithm adapted from Introduction to Information Retrieval by Manning et al., Cambridge University Press. 2008 [p.386].
*
* @param {Array} data - input data
* @param {Function} linkage - used linkage function
* @param {Function} distance - used distance metric
* @return {Array} a list holding merge instructions
*/

/**
* Binary search algorithm returning the index at which the element if inserted would be larger than all elements to the left and smaller than those to the right.
*/

/**
* Code adapted from Nikita Rokotyan. MIT licensed. Source: http://bl.ocks.org/Rokotyan/0556f8facbaf344507cdc45dc3622177
*/

/**
* Creates a two-dimensional array.
*
* @param {number} m - number of rows
* @param {number} n - number of columns
* @return {Array} an empty array of arrays
*/

/**
* Delete the element passed to parameter `elem` from the queue, if present.
*/

/**
* FUNCTION: argmax( arr )
*	Computes the maximum value of a numeric array and returns the corresponding array indices.
*
* @param {Array} arr - array of values
* @returns {Array} array indices
*/

/**
* FUNCTION: chebyshev( x, y[, accessor] )
*	Computes the Chebyshev distance between two arrays.
*
* @param {Number[]|Array} x - input array
* @param {Number[]|Array} y - input array
* @param {Function} [accessor] - accessor function for accessing array values
* @returns {Number|Null} Chebyshev distance or null
*/

/**
* FUNCTION: distance( x, y[, accessor] )
*	Computes the cosine distance between two arrays.
*
* @param {Number[]|Array} x - input array
* @param {Number[]|Array} y - input array
* @param {Function} [accessor] - accessor function for accessing array values
* @returns {Number|Null} Cosine distance
*/

/**
* FUNCTION: dot( x, y[, accessor] )
*	Computes the dot product between two arrays.
*
* @param {Array} x - input array
* @param {Array} y - input array
* @param {Function} [accessor] - accessor function for accessing array values
* @returns {Number|Null} dot product
*/

/**
* FUNCTION: euclidean( x, y[, accessor] )
*	Computes the Euclidean distance between two arrays.
*
* @param {Number[]|Array} x - input array
* @param {Number[]|Array} y - input array
* @param {Function} [accessor] - accessor function for accessing array values
* @returns {Number|Null} Euclidean distance or null
*/

/**
* FUNCTION: hamming( a, b, accessor )
*	Computes the Hamming distance between two sequences.
*
* @param {String|Array} a - array or string sequence
* @param {String|Array} b - array or string sequence
* @param {Function} [accessor] - accessor function for accessing array values
* @returns {Number} Hamming distance
*/

/**
* FUNCTION: isFunction( value )
*	Validates if a value is a function.
*
* @param {*} value - value to be validated
* @returns {Boolean} boolean indicating whether value is a function
*/

/**
* FUNCTION: isString( value )
*	Validates if a value is a string.
*
* @param {*} value - value to be validated
* @returns {Boolean} boolean indicating whether value is a string
*/

/**
* FUNCTION: l2norm( arr[, accessor] )
*	Calculates the L2 norm (Euclidean norm) of an array.
*
* @param {Array} arr - input array
* @param {Function} [accessor] - accessor function for accessing array values
* @returns {Number|Null} L2 norm or null
*/

/**
* FUNCTION: manhattan( x, y[, accessor] )
*	Computes the Manhattan distance between two arrays.
*
* @param {Number[]|Array} x - input array
* @param {Number[]|Array} y - input array
* @param {Function} [accessor] - accessor function for accessing array values
* @returns {Number|Null} Manhattan distance or null
*/

/**
* FUNCTION: similarity( x, y[, accessor] )
*	Computes the cosine similarity between two arrays.
*
* @param {Number[]|Array} x - input array
* @param {Number[]|Array} y - input array
* @param {Function} [accessor] - accessor function for accessing array values
* @returns {Number|Null} cosine similarity or null
*/

/**
* Hierarchical Clustering.
*
* @property {Object} data - object of value arrays
* @property {Array<string>} variables - names of variables used for clustering
* @property {string} linkage - either `complete` or `single`
* @property {string} distance - used distance (`euclidean`, `chebyshev`, `cosine`, `hamming`, or `manhattan`)
* @property {Function} onResult - callback invoked with model object
*/

/**
* Hierarchical clustering based on priority-queue algorithm. Implements single-linkage and complete-linkage.
*
* @param {Array} data - two-dimensional array
* @param {Object} [opts] - function options
* @param {String} [opts.linkage='complete'] - accessor function for accessing array values
* @param {String} [opts.distance='euclidean'] - boolean indicating whether to return a new array
* @return {Object} an object exposing two functions, `getTree` and `getClusters(k)`, where `k` is the number of clusters
*/

/**
* Represents a PriorityQueue. Elements queued will always be sorted in increasing order.
*
* @param {Array} values - input array of values
* @constructor
*/

/**
* Reset the queue to zero elements
*/

/**
* Return the number of elements currently in the queue
*/

/**
* Returns a function which checks whether an element is equal to input.
*
* @param {string} input - the element the generated function should compare to
* @return {Function} a function which when invoked checks whether its first argument is equal to input
*/

/**
* Returns the maximum element currently in the queue and remove it.
*/

/**
* Returns the maximum element currently in the queue.
*/

/**
* Test if a value is an array of arrays.
*
* @module @stdlib/assert/is-array-array
*
* @example
* var isArrayArray = require( '@stdlib/assert/is-array-array' );
*
* var bool = isArrayArray( [ [], [] ] );
* // returns true
*
* bool = isArrayArray( [ {}, {} ] );
* // returns false
*
* bool = isArrayArray( [] );
* // returns false
*/

/***/

// CHEBYSHEV DISTANCE //

// COSINE DISTANCE //

// COSINE SIMILARITY //

// Calculate mid point:

// Convert SVG string to data URL

// DOT PRODUCT //

// EUCLIDEAN DISTANCE //

// EXPORTS //

// Exports

// FUNCTIONS //

// Fix root xlink without namespace

// HAMMING DISTANCE //

// L2NORM //

// MAIN //

// MANHATTAN DISTANCE //

// MODULES //

// Module

// PROPERTIES //

// Safari NS namespace fix

// call the draw function

// call the tree layout function on the data

// define the draw function

// define the tree layout function

// end FUNCTION argmax()

// end FUNCTION chebyshev()

// end FUNCTION distance()

// end FUNCTION dot()

// end FUNCTION euclidean()

// end FUNCTION hamming()

// end FUNCTION isFunction()

// end FUNCTION isString()

// end FUNCTION l2norm()

// end FUNCTION manhattan()

// end FUNCTION partial()

// end FUNCTION similarity()

// for Firefox
