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
type | |
SMatrixNM*[M, N, T] = object | |
aij*: array[M, array[N, T]] | |
TMatrixNM*[M, N, T] = ref SMatrixNM[M, N, T] | |
TVector3*[T] = TVectorN[range[0..2], T] | |
proc newObj[T](): T = | |
result.new() | |
macro newBlub(e: expr): stmt = |
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
{-# LANGUAGE FlexibleContexts #-} | |
import Graphics.Rendering.OpenGL.GL.Tensor | |
import Data.Array.Accelerate as A | |
import qualified Data.Array.Repa as R | |
import qualified Data.Array.Accelerate.CUDA as I | |
import Data.List hiding (intersect) | |
import Foreign.C.Types | |
import Foreign.Ptr | |
import Data.Int |
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
{-# LANGUAGE FlexibleContexts #-} | |
import Graphics.Rendering.OpenGL.GL.Tensor | |
import Data.Array.Accelerate as A | |
import qualified Data.Array.Repa as R | |
import qualified Data.Array.Accelerate.CUDA as I | |
import Data.List hiding (intersect) | |
import Foreign.C.Types | |
import Foreign.Ptr | |
import Data.Int |
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
{-# LANGUAGE FlexibleContexts #-} | |
import Graphics.Rendering.OpenGL.GL.Tensor | |
import Data.Array.Accelerate as A | |
import qualified Data.Array.Repa as R | |
import qualified Data.Array.Accelerate.CUDA as I | |
import Data.List hiding (intersect) | |
import Foreign.C.Types | |
import Foreign.Ptr | |
import Data.Int |
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
sfold :: (Shape ix, Elt a) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Array ix a) -> Exp a | |
sfold f i a = let | |
iteratefunc :: (Elt a, Shape ix) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Array ix a) -> Exp Int -> Exp a | |
iteratefunc f i ar idx = let new = f i (ar A.!! idx) in | |
(idx <* (size ar) - 1) ? ((f new (iteratefunc f new ar (idx+1))), new) | |
-- new | |
in | |
iteratefunc f i a $ constant 0 |
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
sfold :: (Shape ix, Elt a) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Array ix a) -> Exp a | |
sfold f i a = let | |
iteratefunc :: (Elt a) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Vector a) -> Exp a | |
iteratefunc !f !i !ar = | |
((size ar) ==* 0) ? (i, | |
let | |
hd = A.take (constant 1) ar A.!! 0 | |
tl = A.tail ar | |
in | |
f hd (iteratefunc f i tl)) |
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
sfold :: (Shape ix, Elt a) => (Exp a -> Exp a -> Exp a) -> Exp a -> Acc (Array ix a) -> Exp a | |
sfold f i a = let | |
iteratefunc :: (Elt a) => (Exp a -> Exp a -> Exp a) -> (Exp a -> Exp a) -> Exp a -> Acc (Vector a) -> Exp a | |
iteratefunc f f' i ar = | |
((size ar) ==* 0) ? (f' i, | |
let | |
hd = A.take (constant 1) ar A.!! 0 | |
tl = A.tail ar | |
in | |
iteratefunc f (f' . f hd) i tl) |
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
intersectDist :: Exp Ray -> Exp Sphere -> Exp SphereIntersect | |
intersectDist r s = | |
let | |
v = (center s) -. (start r) | |
a = dot v (dir r) | |
in | |
(a <* 0) ? ( | |
lift $ (constant False, s, constant (-1.0)), | |
let | |
b2 = dot v v - a * a |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace SQFArrayParser | |
{ | |
class ListBlock | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace SQFArrayParser | |
{ | |
class ListBlock | |
{ |
OlderNewer