FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaFastPFORDemo/src/main/java/org/example/Main.java at main · fast-pack/JavaFastPFORDemo · GitHub
fast-pack
JavaFastPFORDemo
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaFastPFORDemo
/
src
/
main
/
java
/
org
/
example
/
Main.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (31 loc) · 1.39 KB
Breadcrumbs
JavaFastPFORDemo
/
src
/
main
/
java
/
org
/
example
/
Main.java
Copy path
File metadata and controls
41 lines (31 loc) · 1.39 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package
org
.
example
;
import
me
.
lemire
.
integercompression
.
FastPFOR128
;
import
me
.
lemire
.
integercompression
.
IntWrapper
;
import
java
.
util
.
Arrays
;
public
class
Main
{
public
static
void
main
(
String
[]
args
) {
FastPFOR128
fastpfor
=
new
FastPFOR128
();
int
N
=
9984
;
int
[]
data
=
new
int
[
N
];
for
(
var
i
=
0
;
i
<
N
;
i
+=
150
) {
data
[
i
] =
i
;
}
int
[]
compressedoutput1
=
new
int
[
N
+
1024
];
IntWrapper
inputoffset1
=
new
IntWrapper
(
0
);
IntWrapper
outputoffset1
=
new
IntWrapper
(
0
);
fastpfor
.
compress
(
data
,
inputoffset1
,
N
,
compressedoutput1
,
outputoffset1
);
int
compressedsize1
=
outputoffset1
.
get
();
int
[]
recovered1
=
new
int
[
N
];
inputoffset1
=
new
IntWrapper
(
0
);
outputoffset1
=
new
IntWrapper
(
0
);
fastpfor
.
uncompress
(
compressedoutput1
,
outputoffset1
,
compressedsize1
,
recovered1
,
inputoffset1
);
// quick verification: count mismatches
int
mismatches
=
0
;
for
(
int
i
=
0
;
i
<
N
;
i
++) {
if
(
data
[
i
] !=
recovered1
[
i
])
mismatches
++;
}
System
.
out
.
println
(
"N="
+
N
+
" compressedSizeWords="
+
compressedsize1
+
" mismatches="
+
mismatches
);
System
.
out
.
println
(
"first 20 original: "
+
Arrays
.
toString
(
Arrays
.
copyOf
(
data
,
20
)));
System
.
out
.
println
(
"first 20 recovered: "
+
Arrays
.
toString
(
Arrays
.
copyOf
(
recovered1
,
20
)));
}
}
Back
|
FazBrowse Home
|
New Git URL