Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Prolog mlpack Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
Prolog mlpack Library
Commits
0c025c59
Commit
0c025c59
authored
Sep 15, 2022
by
Jakhes
Browse files
Options
Downloads
Patches
Plain Diff
Adding code snippets to the template
parent
9f79b225
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/methods/new_method/new_method.cpp
+11
-47
11 additions, 47 deletions
src/methods/new_method/new_method.cpp
with
11 additions
and
47 deletions
src/methods/new_method/new_method.cpp
+
11
−
47
View file @
0c025c59
...
@@ -26,50 +26,14 @@ void sampleFunction()
...
@@ -26,50 +26,14 @@ void sampleFunction()
}
}
// Basic input parameters
void
takeNumberFunction
(
SP_integer
integerNumber
,
double
doubleNumber
,
char
const
*
string
)
//
{
// SP_integer integerNumber, double doubleNumber, char const *string
//
}
// Snippets
//
SP_integer
returnNumberFunction
()
// Take Matrix: mat-take, take-mat
{
// Take Array: arr-take, take-arr
return
7
;
//
}
// Return Matrix: mat-return, return-mat
// Return Array: arr-return, return-arr
void
takeMatrixFunction
(
float
*
givenMatArr
,
SP_integer
givenMatSize
,
SP_integer
givenMatRowNum
)
{
// convert the Prolog arrays to arma::mat
mat
data
=
convertArrayToMat
(
givenMatArr
,
givenMatSize
,
givenMatRowNum
);
}
void
takeArrayFunction
(
float
*
givenArr
,
SP_integer
givenArrSize
)
{
// convert the Prolog arrays to arma::rowvec
rowvec
givenVector
=
convertArrayToRowvec
(
givenArr
,
givenArrSize
);
}
void
returnMatrixFunction
(
float
**
returnMatArr
,
SP_integer
*
returnMatColNum
,
SP_integer
*
returnMatRowNum
)
{
// get the ReturnMat
mat
toReturnMat
=
rowvec
(
3
,
3
,
fill
::
ones
);
// return the Matrix dimensions
*
returnMatColNum
=
toReturnMat
.
n_cols
;
*
returnMatRowNum
=
toReturnMat
.
n_rows
;
// return the Matrix as one long Array
*
returnMatArr
=
convertToArray
(
toReturnMat
);
}
void
returnArrayFunction
(
float
**
returnArr
,
SP_integer
*
returnArrSize
)
{
// get the ReturnVector
rowvec
toReturnVector
=
rowvec
(
3
,
fill
::
ones
);
// return the Vector lenght
*
returnArrSize
=
toReturnVector
.
n_elem
;
// return the Vector as Array
*
returnArr
=
convertToArray
(
toReturnVector
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment