mirror of
https://github.com/sjwhitworth/golearn.git
synced 2025-04-26 13:49:14 +08:00
21 lines
436 B
Go
21 lines
436 B
Go
package pairwise
|
|
|
|
import (
|
|
mat "github.com/skelterjohn/go.matrix"
|
|
)
|
|
|
|
type Metric interface {
|
|
InnerProduct(vectorX *mat.DenseMatrix, vectorY *mat.DenseMatrix)
|
|
Distance(vectorX *mat.DenseMatrix, vectorY *mat.DenseMatrix)
|
|
}
|
|
|
|
func CheckDimMatch(vectorX *mat.DenseMatrix, vectorY *mat.DenseMatrix) bool {
|
|
if vectorX.Cols() != 1 ||
|
|
vectorY.Cols() != 1 ||
|
|
vectorX.Rows() != vectorY.Rows() {
|
|
return false
|
|
} else {
|
|
return true
|
|
}
|
|
}
|