Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <limits>
template <typename T, typename F, typename P>
T collision_point(T const& x, F f, P p) {
if (!p(x))
return x;
T slow = x;
T fast = f(x);
while (fast != slow) {
@taless474
taless474 / build-py2-silo.bat
Last active November 27, 2018 19:10
Dockerfile for pyublas
docker build -t bitahn90/pyublas:python2-silo -f py2.dockerfile .
docker push bitahn90/pyublas:python2-silo
@taless474
taless474 / CMakeLists.txt
Created December 7, 2018 22:32
Blaze test case
cmake_minimum_required(VERSION 3.3.2)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
project(hpxapp1 CXX)
find_package(HPX REQUIRED)
find_package(blaze NO_CMAKE_PACKAGE_REGISTRY)
@taless474
taless474 / blaze_tensor.bat
Created January 11, 2019 16:52
Building Phylanx with blaze tensor
cd blaze_tensor
rd /s /q cmake-build-debug
cmake -C ../blaze_tensor_cache.cmake -H. -Bcmake-build-debug -G"Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX="C:/Repos/blaze_tensor/cmake-install"
cmake --build cmake-build-debug --config Debug --target install
pause
@taless474
taless474 / CMakeLists.txt
Created September 26, 2019 15:30
prog cmake
cmake_minimum_required(VERSION 3.3.2)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(APP1_BLAZE_TENSOR_DIR "Path to BlazeTensor" "")
project(blaze_app_1 CXX)
find_package(HPX REQUIRED)
// Copyright (c) 2020 Bita Hasheminezhad
// Copyright (c) 2020 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <phylanx/phylanx.hpp>
#include <hpx/hpx_init.hpp>
char const* const kmeans_code = R"(
define(closest_centroids, points, centroids, block(
define(expanded_centroids,
reshape(centroids, list(shape(centroids, 0), 1, 2))
),
define(distances,
sqrt(sum(square(points - expanded_centroids), 2))
),
argmin(distances, 0)
))
void test_shape_2d_0()
{
if (hpx::get_locality_id() == 0)
{
test_shape_d_operation("test_shape_2loc2d_0", R"(
shape(annotate_d([[-1,-2,-3], [1, 2, 3]], "array",
list("tile", list("rows", 1, 3), list("columns", 0, 3))))
)", "list(2, 3)");
}
else
void test_expand_dims_1d_3()
{
if (hpx::get_locality_id() == 0)
{
test_expand_dims_operation("test_expand_dims_2loc1d_3", R"(
expand_dims(
annotate_d([1., 2., 3., 4.], "array_3",
list("tile", list("columns", 4, 8)))
, -1)
)", R"(
docker image prune -f