-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provisional gfor() iterator, calling gforGet() in binary operators an…
…d math ops Use in rainfall sample (but need array proxies to finish) Stub for index objects Sprinkling of notes about how to add array proxies, tentative idea being to integrate them as arrays with different GetHandle() and SetHandle() behavior, and various operations disabled
- Loading branch information
Showing
7 changed files
with
113 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- gfor() mechanism. | ||
|
||
-- Standard library imports -- | ||
local assert = assert | ||
|
||
-- Modules -- | ||
local array = require("lib.impl.array") | ||
|
||
-- Imports -- | ||
local GetLib = array.GetLib | ||
|
||
-- Exports -- | ||
local M = {} | ||
|
||
--- See also: https://github.com/arrayfire/arrayfire/blob/devel/include/af/gfor.h | ||
-- https://github.com/arrayfire/arrayfire/blob/devel/src/api/cpp/gfor.cpp | ||
|
||
-- -- | ||
local Status = false | ||
|
||
-- | ||
local function AuxGfor (seq) | ||
Status = not Status | ||
|
||
if Status then | ||
return seq | ||
end | ||
end | ||
|
||
-- | ||
function M.Add (into) | ||
for k, v in pairs{ | ||
-- | ||
batchFunc = function(lhs, rhs, func) | ||
assert(not Status, "batchFunc can not be used inside GFOR") -- TODO: AF_ERR_ARG | ||
|
||
Status = true | ||
|
||
local res = func(lhs, rhs) | ||
|
||
Status = false | ||
|
||
return res | ||
end, | ||
|
||
-- | ||
gfor = function(...) | ||
local lib = GetLib() | ||
|
||
return AuxGfor, lib.seq(lib.seq(...), true) | ||
end, | ||
|
||
-- | ||
gforGet = function() | ||
return Status | ||
end, | ||
|
||
-- | ||
gforSet = function(val) | ||
Status = not not val | ||
end | ||
} do | ||
into[k] = v | ||
end | ||
end | ||
|
||
-- Export the module. | ||
return M |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- Core index module. | ||
|
||
-- Modules -- | ||
local af = require("arrayfire") | ||
|
||
-- Forward declarations -- | ||
|
||
-- Exports -- | ||
local M = {} | ||
|
||
-- | ||
function M.Add (array_module) | ||
-- Import these here since the array module is not yet registered. | ||
|
||
|
||
end | ||
|
||
-- Export the module. | ||
return M |
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
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