This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.example; | |
| import java.io.IOException; | |
| import java.nio.charset.StandardCharsets; | |
| // In Java8: java.lang.OutOfMemoryError: Java heap space | |
| // In Java9+: java.lang.NegativeArraySizeException: -1894967266 | |
| public class Main { | |
| static byte[] generateData() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Code snippet for read/write Date logical type that currently unsupported in Beam Python | |
| # without the need of cast, by implements your own LogicalType (DateType) | |
| import datetime | |
| from decimal import Decimal | |
| import logging | |
| import typing | |
| from apache_beam.coders.row_coder import LogicalType | |
| from apache_beam.typehints.schemas import MillisInstant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Licensed to the Apache Software Foundation (ASF) under one or more | |
| # contributor license agreements. See the NOTICE file distributed with | |
| # this work for additional information regarding copyright ownership. | |
| # The ASF licenses this file to You under the Apache License, Version 2.0 | |
| # (the "License"); you may not use this file except in compliance with | |
| # the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Licensed to the Apache Software Foundation (ASF) under one or more | |
| # contributor license agreements. See the NOTICE file distributed with | |
| # this work for additional information regarding copyright ownership. | |
| # The ASF licenses this file to You under the Apache License, Version 2.0 | |
| # (the "License"); you may not use this file except in compliance with | |
| # the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Periodic boundary condition and minimum image in Dn lattice (n-dimensional dense packing, n>=4) | |
| * Created by Yi Hu on 6/13/19. | |
| * Refer to: J. Convay and N. Sloane, IEEE Trans Inform Theory 28, 227 (1982). | |
| */ | |
| #include <cstdint> | |
| #include <cmath> | |
| // Dimensionality DIM >= 4 | |
| #define DIM 8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Periodic boundary condition and minimum image in Dn lattice (n-dimensional dense packing, n>=4) | |
| * Created by Yi Hu on 6/13/19. | |
| * Refer to: J. Convay and N. Sloane, IEEE Trans Inform Theory 28, 227 (1982). | |
| */ | |
| #include <cstdint> | |
| #include <cmath> | |
| // Dimensionality DIM >= 4 | |
| #define DIM 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Compiling command: | |
| g++ -o Qhullex Qhullex.cpp -lqhullstatic_r -lqhullcpp | |
| Note: | |
| (1) this is the minimum example (user_eg3) in qhull package, also mentioned in http://www.qhull.org/html/qh-code.htm#cpp . | |
| However, the version on the website (Dated 03/19/2019) is inconsistent with the source code and it does not pass the compiler | |
| (2) libqhullstatic_r is the correct library to use. | |
| * Linking to libqhull results in runtime error | |
| "QH6248 qh_lib_check: Incorrect qhull library called. Caller uses reentrant Qhull while library is non-reentrant"; | |
| * Linking to libqhull_r results in runtime error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <libqhullcpp/Qhull.h> | |
| #include <libqhullcpp/QhullFacetList.h> | |
| #include <libqhullcpp/RboxPoints.h> | |
| using namespace std; | |
| using namespace orgQhull; | |
| int main(void) { | |
| RboxPoints rbox("100"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Test Poisson distribution generator | |
| #include <stdio.h> | |
| #include <time.h> | |
| #include <random> | |
| int main() | |
| { | |
| int ntest = 10; | |
| double Nmin = 100000.; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ellipse.cpp | |
| // EllipticalCylinder | |
| // | |
| // Created by Yi Hu on 4/6/18. | |
| // | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <math.h> | |
| #include <nlopt.h> |
NewerOlder