Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gomatrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel Jankowski
gomatrix
Commits
d819af7a
Commit
d819af7a
authored
6 years ago
by
Daniel Jankowski
Browse files
Options
Downloads
Patches
Plain Diff
Fixed: spelling errors and gitlab ci to go 1.12
parent
8880095a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitlab-ci.yml
+2
-5
2 additions, 5 deletions
.gitlab-ci.yml
algebra.go
+7
-8
7 additions, 8 deletions
algebra.go
gaussian.go
+0
-1
0 additions, 1 deletion
gaussian.go
matrix.go
+1
-1
1 addition, 1 deletion
matrix.go
print.go
+7
-8
7 additions, 8 deletions
print.go
with
17 additions
and
23 deletions
.gitlab-ci.yml
+
2
−
5
View file @
d819af7a
...
...
@@ -24,9 +24,8 @@ test:
# install the dependencies
-
dep ensure
-
mkdir report/
-
export GOCACHE=off
# run the tests with coverage report
-
go test -coverprofile report/cover.out -covermode=count ./...
-
go test
-count=1
-coverprofile report/cover.out -covermode=count ./...
# convert the coverage report to html and copy it back into the project directory
-
go tool cover -html=report/cover.out -o report/cover.html
-
cp -R report $CI_PROJECT_DIR/.
...
...
@@ -52,7 +51,6 @@ lint:
# install the dependencies
-
dep ensure
-
mkdir report/
-
export GOCACHE=off
# install golint
-
go get -u golang.org/x/lint/golint
# run the tests with coverage report
...
...
@@ -79,6 +77,5 @@ memory-sanitizer:
# install the dependencies
-
dep ensure
-
mkdir report/
-
export GOCACHE=off
# run the tests with coverage report
-
CC=clang go test -msan -short $(go list ./... | grep -v /vendor/)
\ No newline at end of file
-
CC=clang go test -count=1 -msan -short $(go list ./... | grep -v /vendor/)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
algebra.go
+
7
−
8
View file @
d819af7a
// Package gomatrix Is a go package for scientific operations with matrices in F2.
package
gomatrix
import
(
...
...
@@ -43,7 +42,7 @@ func (f *F2) AddMatrix(m *F2) *F2 {
func
(
f
*
F2
)
MulMatrix
(
m
*
F2
)
*
F2
{
// if the dimensions do not fit for a multiplication...
if
f
.
N
!=
m
.
M
{
// ...ret
r
un an error
// ...retu
r
n an error
return
nil
}
...
...
@@ -96,26 +95,26 @@ func addBits(number *big.Int) uint {
return
result
}
// PartialXor xors the bits from startCol to stopCol
// PartialXor xor
'
s the bits from startCol to stopCol
//
// @param *big.Int x The base number to xor
// @param *big.Int y The number with the bits to xor
// @param int startCol The start index of the bitmask
// @param int stopCol The stop index of the bitmask
// @param int startCol The start index of the bit
mask
// @param int stopCol The stop index of the bit
mask
//
// @return *big.Int
func
PartialXor
(
x
,
y
*
big
.
Int
,
startCol
,
stopCol
int
)
*
big
.
Int
{
bitLength
:=
stopCol
-
startCol
// create the bitmask
// create the bit
mask
bitMask
:=
big
.
NewInt
(
0
)
.
Exp
(
big
.
NewInt
(
2
),
big
.
NewInt
(
int64
(
bitLength
+
1
)),
nil
,
)
// decrease the bitmask by one
// decrease the bit
mask by one
bitMask
.
Sub
(
bitMask
,
big
.
NewInt
(
1
))
// shift the bitmask to the correct position
// shift the bit
mask to the correct position
bitMask
.
Lsh
(
bitMask
,
uint
(
startCol
))
// get the bits to xor
...
...
This diff is collapsed.
Click to expand it.
gaussian.go
+
0
−
1
View file @
d819af7a
// Package gomatrix Is a go package for scientific operations with matrices in F2.
package
gomatrix
// GaussianElimination converts the matrix to an echelon form
...
...
This diff is collapsed.
Click to expand it.
matrix.go
+
1
−
1
View file @
d819af7a
...
...
@@ -9,7 +9,7 @@ import (
// F2 represents a matrix with entries that contains 0 or 1
//
// Each row consists of one big Int with arbitray size. Each column is one bit
// Each row consists of one big Int with arbitra
r
y size. Each column is one bit
// at 2**(column_index) of the big Int in each row.
type
F2
struct
{
N
int
...
...
This diff is collapsed.
Click to expand it.
print.go
+
7
−
8
View file @
d819af7a
// Package gomatrix Is a go package for scientific operations with matrices in F2.
package
gomatrix
import
(
...
...
@@ -7,26 +6,26 @@ import (
// PrettyPrint prints the matrix to stdout
func
(
f
*
F2
)
PrettyPrint
()
{
f
.
printWithSep
e
rators
(
" "
,
"
\n
"
)
f
.
printWithSep
a
rators
(
" "
,
"
\n
"
)
}
// PrintLaTex prints the matrix as latex code
func
(
f
*
F2
)
PrintLaTex
()
{
fmt
.
Printf
(
"
\\
begin{bmatrix}
\n
"
)
f
.
printWithSep
e
rators
(
" & "
,
"
\\\n
"
)
f
.
printWithSep
a
rators
(
" & "
,
"
\\\n
"
)
fmt
.
Printf
(
"
\\
end{bmatrix}
\n
"
)
}
// PrintCSV prints the matrix as csv
func
(
f
*
F2
)
PrintCSV
()
{
f
.
printWithSep
e
rators
(
", "
,
"
\n
"
)
f
.
printWithSep
a
rators
(
", "
,
"
\n
"
)
}
// printWithSep
e
rators prints the matrix with custom seperators
// printWithSep
a
rators prints the matrix with custom seperators
//
// @param string valSep The sep
e
rator for the single values
// @param string lineSep The line sep
e
rator
func
(
f
*
F2
)
printWithSep
e
rators
(
valSep
,
lineSep
string
)
{
// @param string valSep The sep
a
rator for the single values
// @param string lineSep The line sep
a
rator
func
(
f
*
F2
)
printWithSep
a
rators
(
valSep
,
lineSep
string
)
{
for
_
,
row
:=
range
f
.
Rows
{
for
i
:=
0
;
i
<
f
.
M
;
i
++
{
if
i
==
f
.
M
-
1
{
...
...
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