Skip to content

Commit

Permalink
Update to version 4.0.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcurtin committed Dec 29, 2022
1 parent 3463caa commit 509c128
Show file tree
Hide file tree
Showing 50 changed files with 80 additions and 1,118 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.PHONY: test deps download build clean docker

# mlpack version to use.
MLPACK_VERSION?=4.0.0
MLPACK_VERSION?=4.0.1

# armadillo version to use.
ARMA_VERSION?=9.800.1
Expand Down
4 changes: 2 additions & 2 deletions adaboost.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func Adaboost(param *AdaboostOptionalParam) (*mat.Dense, adaBoostModel, *mat.Den

// Detect if the parameter was passed; set if so.
if param.Test != nil {
gonumToArmaMat(params, "test", param.Test)
gonumToArmaMat(params, "test", param.Test, false)
setPassed(params, "test")
}

Expand All @@ -148,7 +148,7 @@ func Adaboost(param *AdaboostOptionalParam) (*mat.Dense, adaBoostModel, *mat.Den

// Detect if the parameter was passed; set if so.
if param.Training != nil {
gonumToArmaMat(params, "training", param.Training)
gonumToArmaMat(params, "training", param.Training, false)
setPassed(params, "training")
}

Expand Down
6 changes: 3 additions & 3 deletions approx_kfn.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func ApproxKfn(param *ApproxKfnOptionalParam) (*mat.Dense, *mat.Dense, approxkfn

// Detect if the parameter was passed; set if so.
if param.ExactDistances != nil {
gonumToArmaMat(params, "exact_distances", param.ExactDistances)
gonumToArmaMat(params, "exact_distances", param.ExactDistances, false)
setPassed(params, "exact_distances")
}

Expand Down Expand Up @@ -188,13 +188,13 @@ func ApproxKfn(param *ApproxKfnOptionalParam) (*mat.Dense, *mat.Dense, approxkfn

// Detect if the parameter was passed; set if so.
if param.Query != nil {
gonumToArmaMat(params, "query", param.Query)
gonumToArmaMat(params, "query", param.Query, false)
setPassed(params, "query")
}

// Detect if the parameter was passed; set if so.
if param.Reference != nil {
gonumToArmaMat(params, "reference", param.Reference)
gonumToArmaMat(params, "reference", param.Reference, false)
setPassed(params, "reference")
}

Expand Down
4 changes: 2 additions & 2 deletions arma_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (m *mlpackArma) allocArmaPtrMatWithInfo(p *params,
}

// Passes a Gonum matrix to C by using the underlying data from the Gonum matrix.
func gonumToArmaMat(p *params, identifier string, m *mat.Dense) {
func gonumToArmaMat(p *params, identifier string, m *mat.Dense, trans bool) {
// Get the number of elements in the Armadillo column.
r, c := m.Dims()
blas64General := m.RawMatrix()
Expand All @@ -100,7 +100,7 @@ func gonumToArmaMat(p *params, identifier string, m *mat.Dense) {
// Pass pointer of the underlying matrix to mlpack.
ptr := unsafe.Pointer(&data[0])
C.mlpackToArmaMat(p.mem, C.CString(identifier), (*C.double)(ptr),
C.size_t(c), C.size_t(r))
C.size_t(c), C.size_t(r), C.bool(trans))
}

// Passes a Gonum matrix to C by using the underlying data from the Gonum matrix.
Expand Down
4 changes: 2 additions & 2 deletions bayesian_linear_regression.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func BayesianLinearRegression(param *BayesianLinearRegressionOptionalParam) (bay

// Detect if the parameter was passed; set if so.
if param.Input != nil {
gonumToArmaMat(params, "input", param.Input)
gonumToArmaMat(params, "input", param.Input, false)
setPassed(params, "input")
}

Expand All @@ -156,7 +156,7 @@ func BayesianLinearRegression(param *BayesianLinearRegressionOptionalParam) (bay

// Detect if the parameter was passed; set if so.
if param.Test != nil {
gonumToArmaMat(params, "test", param.Test)
gonumToArmaMat(params, "test", param.Test, false)
setPassed(params, "test")
}

Expand Down
3 changes: 2 additions & 1 deletion capi/arma_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ void mlpackToArmaMat(void* params,
const char* identifier,
double* mat,
const size_t row,
const size_t col);
const size_t col,
bool transpose);

/**
* Pass Gonum Dense pointer and wrap an Armadillo mat around it.
Expand Down
37 changes: 0 additions & 37 deletions capi/test_go_binding.h

This file was deleted.

4 changes: 2 additions & 2 deletions cf.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,13 @@ func Cf(param *CfOptionalParam) (*mat.Dense, cfModel) {

// Detect if the parameter was passed; set if so.
if param.Test != nil {
gonumToArmaMat(params, "test", param.Test)
gonumToArmaMat(params, "test", param.Test, false)
setPassed(params, "test")
}

// Detect if the parameter was passed; set if so.
if param.Training != nil {
gonumToArmaMat(params, "training", param.Training)
gonumToArmaMat(params, "training", param.Training, false)
setPassed(params, "training")
}

Expand Down
2 changes: 1 addition & 1 deletion dbscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func Dbscan(input *mat.Dense, param *DbscanOptionalParam) (*mat.Dense, *mat.Dens
disableBacktrace()
disableVerbose()
// Detect if the parameter was passed; set if so.
gonumToArmaMat(params, "input", input)
gonumToArmaMat(params, "input", input, false)
setPassed(params, "input")

// Detect if the parameter was passed; set if so.
Expand Down
2 changes: 1 addition & 1 deletion decision_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func DecisionTree(param *DecisionTreeOptionalParam) (decisionTreeModel, *mat.Den

// Detect if the parameter was passed; set if so.
if param.Weights != nil {
gonumToArmaMat(params, "weights", param.Weights)
gonumToArmaMat(params, "weights", param.Weights, false)
setPassed(params, "weights")
}

Expand Down
4 changes: 2 additions & 2 deletions det.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ func Det(param *DetOptionalParam) (dTree, string, string, *mat.Dense, *mat.Dense

// Detect if the parameter was passed; set if so.
if param.Test != nil {
gonumToArmaMat(params, "test", param.Test)
gonumToArmaMat(params, "test", param.Test, false)
setPassed(params, "test")
}

// Detect if the parameter was passed; set if so.
if param.Training != nil {
gonumToArmaMat(params, "training", param.Training)
gonumToArmaMat(params, "training", param.Training, false)
setPassed(params, "training")
}

Expand Down
2 changes: 1 addition & 1 deletion emst.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func Emst(input *mat.Dense, param *EmstOptionalParam) (*mat.Dense) {
disableBacktrace()
disableVerbose()
// Detect if the parameter was passed; set if so.
gonumToArmaMat(params, "input", input)
gonumToArmaMat(params, "input", input, false)
setPassed(params, "input")

// Detect if the parameter was passed; set if so.
Expand Down
4 changes: 2 additions & 2 deletions fastmks.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ func Fastmks(param *FastmksOptionalParam) (*mat.Dense, *mat.Dense, fastmksModel)

// Detect if the parameter was passed; set if so.
if param.Query != nil {
gonumToArmaMat(params, "query", param.Query)
gonumToArmaMat(params, "query", param.Query, false)
setPassed(params, "query")
}

// Detect if the parameter was passed; set if so.
if param.Reference != nil {
gonumToArmaMat(params, "reference", param.Reference)
gonumToArmaMat(params, "reference", param.Reference, false)
setPassed(params, "reference")
}

Expand Down
2 changes: 1 addition & 1 deletion gmm_probability.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func GmmProbability(input *mat.Dense, inputModel *gmm, param *GmmProbabilityOpti
disableBacktrace()
disableVerbose()
// Detect if the parameter was passed; set if so.
gonumToArmaMat(params, "input", input)
gonumToArmaMat(params, "input", input, false)
setPassed(params, "input")

// Detect if the parameter was passed; set if so.
Expand Down
2 changes: 1 addition & 1 deletion gmm_train.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func GmmTrain(gaussians int, input *mat.Dense, param *GmmTrainOptionalParam) (gm
setPassed(params, "gaussians")

// Detect if the parameter was passed; set if so.
gonumToArmaMat(params, "input", input)
gonumToArmaMat(params, "input", input, false)
setPassed(params, "input")

// Detect if the parameter was passed; set if so.
Expand Down
2 changes: 1 addition & 1 deletion hmm_loglik.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func HmmLoglik(input *mat.Dense, inputModel *hmmModel, param *HmmLoglikOptionalP
disableBacktrace()
disableVerbose()
// Detect if the parameter was passed; set if so.
gonumToArmaMat(params, "input", input)
gonumToArmaMat(params, "input", input, false)
setPassed(params, "input")

// Detect if the parameter was passed; set if so.
Expand Down
2 changes: 1 addition & 1 deletion hmm_viterbi.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func HmmViterbi(input *mat.Dense, inputModel *hmmModel, param *HmmViterbiOptiona
disableBacktrace()
disableVerbose()
// Detect if the parameter was passed; set if so.
gonumToArmaMat(params, "input", input)
gonumToArmaMat(params, "input", input, false)
setPassed(params, "input")

// Detect if the parameter was passed; set if so.
Expand Down
2 changes: 1 addition & 1 deletion image_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func ImageConverter(input []string, param *ImageConverterOptionalParam) (*mat.De

// Detect if the parameter was passed; set if so.
if param.Dataset != nil {
gonumToArmaMat(params, "dataset", param.Dataset)
gonumToArmaMat(params, "dataset", param.Dataset, false)
setPassed(params, "dataset")
}

Expand Down
4 changes: 2 additions & 2 deletions kde.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ func Kde(param *KdeOptionalParam) (kdeModel, *mat.Dense) {

// Detect if the parameter was passed; set if so.
if param.Query != nil {
gonumToArmaMat(params, "query", param.Query)
gonumToArmaMat(params, "query", param.Query, false)
setPassed(params, "query")
}

// Detect if the parameter was passed; set if so.
if param.Reference != nil {
gonumToArmaMat(params, "reference", param.Reference)
gonumToArmaMat(params, "reference", param.Reference, false)
setPassed(params, "reference")
}

Expand Down
2 changes: 1 addition & 1 deletion kernel_pca.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func KernelPca(input *mat.Dense, kernel string, param *KernelPcaOptionalParam) (
disableBacktrace()
disableVerbose()
// Detect if the parameter was passed; set if so.
gonumToArmaMat(params, "input", input)
gonumToArmaMat(params, "input", input, false)
setPassed(params, "input")

// Detect if the parameter was passed; set if so.
Expand Down
6 changes: 3 additions & 3 deletions kfn.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func Kfn(param *KfnOptionalParam) (*mat.Dense, *mat.Dense, kfnModel) {

// Detect if the parameter was passed; set if so.
if param.Query != nil {
gonumToArmaMat(params, "query", param.Query)
gonumToArmaMat(params, "query", param.Query, false)
setPassed(params, "query")
}

Expand All @@ -165,7 +165,7 @@ func Kfn(param *KfnOptionalParam) (*mat.Dense, *mat.Dense, kfnModel) {

// Detect if the parameter was passed; set if so.
if param.Reference != nil {
gonumToArmaMat(params, "reference", param.Reference)
gonumToArmaMat(params, "reference", param.Reference, false)
setPassed(params, "reference")
}

Expand All @@ -183,7 +183,7 @@ func Kfn(param *KfnOptionalParam) (*mat.Dense, *mat.Dense, kfnModel) {

// Detect if the parameter was passed; set if so.
if param.TrueDistances != nil {
gonumToArmaMat(params, "true_distances", param.TrueDistances)
gonumToArmaMat(params, "true_distances", param.TrueDistances, false)
setPassed(params, "true_distances")
}

Expand Down
4 changes: 2 additions & 2 deletions kmeans.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func Kmeans(clusters int, input *mat.Dense, param *KmeansOptionalParam) (*mat.De
setPassed(params, "clusters")

// Detect if the parameter was passed; set if so.
gonumToArmaMat(params, "input", input)
gonumToArmaMat(params, "input", input, false)
setPassed(params, "input")

// Detect if the parameter was passed; set if so.
Expand All @@ -179,7 +179,7 @@ func Kmeans(clusters int, input *mat.Dense, param *KmeansOptionalParam) (*mat.De

// Detect if the parameter was passed; set if so.
if param.InitialCentroids != nil {
gonumToArmaMat(params, "initial_centroids", param.InitialCentroids)
gonumToArmaMat(params, "initial_centroids", param.InitialCentroids, false)
setPassed(params, "initial_centroids")
}

Expand Down
6 changes: 3 additions & 3 deletions knn.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func Knn(param *KnnOptionalParam) (*mat.Dense, *mat.Dense, knnModel) {

// Detect if the parameter was passed; set if so.
if param.Query != nil {
gonumToArmaMat(params, "query", param.Query)
gonumToArmaMat(params, "query", param.Query, false)
setPassed(params, "query")
}

Expand All @@ -162,7 +162,7 @@ func Knn(param *KnnOptionalParam) (*mat.Dense, *mat.Dense, knnModel) {

// Detect if the parameter was passed; set if so.
if param.Reference != nil {
gonumToArmaMat(params, "reference", param.Reference)
gonumToArmaMat(params, "reference", param.Reference, false)
setPassed(params, "reference")
}

Expand Down Expand Up @@ -192,7 +192,7 @@ func Knn(param *KnnOptionalParam) (*mat.Dense, *mat.Dense, knnModel) {

// Detect if the parameter was passed; set if so.
if param.TrueDistances != nil {
gonumToArmaMat(params, "true_distances", param.TrueDistances)
gonumToArmaMat(params, "true_distances", param.TrueDistances, false)
setPassed(params, "true_distances")
}

Expand Down
4 changes: 2 additions & 2 deletions krann.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func Krann(param *KrannOptionalParam) (*mat.Dense, *mat.Dense, raModel) {

// Detect if the parameter was passed; set if so.
if param.Query != nil {
gonumToArmaMat(params, "query", param.Query)
gonumToArmaMat(params, "query", param.Query, false)
setPassed(params, "query")
}

Expand All @@ -176,7 +176,7 @@ func Krann(param *KrannOptionalParam) (*mat.Dense, *mat.Dense, raModel) {

// Detect if the parameter was passed; set if so.
if param.Reference != nil {
gonumToArmaMat(params, "reference", param.Reference)
gonumToArmaMat(params, "reference", param.Reference, false)
setPassed(params, "reference")
}

Expand Down
6 changes: 3 additions & 3 deletions lars.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func Lars(param *LarsOptionalParam) (lars, *mat.Dense) {
disableVerbose()
// Detect if the parameter was passed; set if so.
if param.Input != nil {
gonumToArmaMat(params, "input", param.Input)
gonumToArmaMat(params, "input", param.Input, true)
setPassed(params, "input")
}

Expand All @@ -150,13 +150,13 @@ func Lars(param *LarsOptionalParam) (lars, *mat.Dense) {

// Detect if the parameter was passed; set if so.
if param.Responses != nil {
gonumToArmaMat(params, "responses", param.Responses)
gonumToArmaMat(params, "responses", param.Responses, false)
setPassed(params, "responses")
}

// Detect if the parameter was passed; set if so.
if param.Test != nil {
gonumToArmaMat(params, "test", param.Test)
gonumToArmaMat(params, "test", param.Test, true)
setPassed(params, "test")
}

Expand Down
Loading

0 comments on commit 509c128

Please sign in to comment.