This file contains 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
# VEXで下記のコードが事前に必要です。 | |
# i[]@neighbours = neighbours(0, @ptnum); | |
# i@point_number = @ptnum; | |
# [ [0, 1], [0, 3] ...] というように、edgeとなるpointの組を返します。 | |
# get_point_pair_for_edge("point_number", "neighbours") | |
def get_point_pair_for_edge(ptnum_attr_name, neighbours_attr_name): | |
# type: (str, str) -> List[List[int]] | |
import hou | |
from itertools import chain |
This file contains 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
# region for autocomplete | |
import hou | |
from hou import SopNode, Node | |
hou.attribType.Point = 1 | |
hou.attribType.Prim = 2 | |
hou.attribType.Vertex = 3 | |
hou.attribType.Global = 4 | |
from typing import List, Type, Any, Union, Callable, Tuple |
This file contains 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
W | |
PY | |
intrinsic:pointcount | |
intrinsic:bounds | |
intrinsic:measuredarea | |
intrinsic:memoryusage | |
@elemnum | |
@ptnum | |
@primnum |
This file contains 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
// paste this into web console | |
codes = $("code"); | |
contents = Array.from(codes).map(i => i.textContent); //.filter(i => i.includes("@")); | |
uniqs = contents.filter((v, i, a) => a.indexOf(v) === i); | |
copy(uniqs.join('\n')); // save array to clipboard |
This file contains 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
.entry-content > ul > li { | |
margin: 0 0 0 36px; | |
} | |
.entry-content > ul { | |
list-style-type: circle; | |
} | |
.entry-content > ol { | |
list-style-type: decimal; | |
} | |
h2 { |
This file contains 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 <cuda_runtime.h> | |
#include <iostream> | |
#include <device_launch_parameters.h> | |
#include "cuda_error_detector.h" | |
#include <vector> | |
#ifdef __CUDACC__ | |
#define KERNEL_ARGS2(numerOfBlocks, threadsPerBlock) <<< numerOfBlocks, threadsPerBlock >>> | |
#define KERNEL_ARGS3(numerOfBlocks, threadsPerBlock, sh_mem) <<< numerOfBlocks, threadsPerBlock, sh_mem >>> |
This file contains 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
#ifdef __CUDACC__ | |
#define KERNEL_ARGS2(numerOfBlocks, threadsPerBlock) <<< numerOfBlocks, threadsPerBlock >>> | |
#define KERNEL_ARGS3(numerOfBlocks, threadsPerBlock, sh_mem) <<< numerOfBlocks, threadsPerBlock, sh_mem >>> | |
#define KERNEL_ARGS4(numerOfBlocks, threadsPerBlock, sh_mem, stream) <<< numerOfBlocks, threadsPerBlock, sh_mem, stream >>> | |
#else | |
#define KERNEL_ARGS2(numerOfBlocks, threadsPerBlock) | |
#define KERNEL_ARGS3(numerOfBlocks, threadsPerBlock, sh_mem) | |
#define KERNEL_ARGS4(numerOfBlocks, threadsPerBlock, sh_mem, stream) | |
#endif |
This file contains 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 <cuda_runtime.h> | |
#include <device_launch_parameters.h> | |
namespace comment_thread_id | |
{ | |
/* | |
blockIdx.x == n | |
blockIdx.y == 1 | |
blockIdx.z == 1 | |
This file contains 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
// Define this to turn on error checking | |
// original https://codeyarns.com/2011/03/02/how-to-do-error-checking-in-cuda/ | |
#ifndef CUDA_ERROR_DETECTOR_H | |
#define CUDA_ERROR_DETECTOR_H | |
#define CUDA_ERROR_CHECK | |
#define CudaSafeCall(err) CUDA_ERROR_DETECTOR::__cudaSafeCall(__FUNCTION__, err, __FILE__, __LINE__ ) // __FUNCTION__ https://stackoverflow.com/questions/679021/how-to-find-the-name-of-the-current-function-at-runtime | |
#define CudaCheckError() CUDA_ERROR_DETECTOR::__cudaCheckError(__FUNCTION__, __FILE__, __LINE__ ) |
This file contains 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
from sympy.tensor.tensor import TensorIndexType, tensor_indices, tensorhead, TensorManager | |
Lorentz = TensorIndexType('Lorentz') | |
i0, i1, i2, i3, i4 = tensor_indices('i0:5', Lorentz) | |
A = tensorhead('A', [Lorentz], [[1]]) | |
G = tensorhead('G', [Lorentz], [[1]], 'Gcomm') | |
GH = tensorhead('GH', [Lorentz], [[1]], 'GHcomm') | |
TensorManager.set_comm('Gcomm', 'GHcomm', 0) | |
(GH(i1) * G(i0)).canon_bp() |