 people
who are doing excellent work for the Kingdom and are taking
great advantage of ATBS.
ATBS has penetrated
into the Hadzabe tribe, an
indigenous ethnic group in north-central Tanzania.
In the Chunya Africa
Training Bible School Center (ATBS) Apostle David is training
the untrained pastors from the Safwa
and Sukuma tribes. These tribes
are un reached tribes according to Joshua projects and the
ATBS Chunya Center is very vital in the area.
The Barabaig another
tribe being impacted by ATBS.
The Barbabaig are a nomadic tribe of the Datooga
people based in the northern volcanic highlands near Mount
Hanang in Manyara Region, Tanzania.
TESTIMONIES:
Here are the words of a church leaders called
Sefania Njema from Mbeya.
"Here in our place we didn't know
the importance of school, in those days our parents were
sending us to take care of animals so this is the reason
many did not go to school, so with this Bible School we
are so thankful because you are reaching even us"
Dear Sister Jenny,
My name is Zawadi Ruvanda the Students Administrator at AFRICAN
TRAINING BIBLE SCHOOL (A.T.B.S) our Bishop and Director of the school
Pastor David has advised me to write you of what we do here at the
school and why we are doing what we are doing.
He has told me about the possibility to receive
Stonecroft Swahili Bible Study books to tell you the truth these
will help us so much as we find it so difficult in finding books
for the Bible school.So such good books will help us a lot and
is a great blessing.
Our Bible School is focusing on reaching those Pastors who can
not afford to go to other Bible School. Our Pastors come mainly
from the remote rural areas,many Pastors in these areas were not
able to complete their education but they love the Lord and are
eager to learn some have up to 400 members in their church and are
loved and respected in their communities.
Witch craft is common in the villages where they come from and
if you are caught as a witch they just burn you, So our school is
penetrating these areas to equip these Pastors so that they reach
their communities.
The situation is terrible thus why we are working very hard to
reach as many pastors as possible, last semister we had 80 pastors,from
Congo,Malawi,Zambia and Tanzania.
We welcome any support of books from Stonecroft and we thank you
so much.
Pastor Zawadi Luvana
Students Administrator
AFRICAN TRAINING BIBLE SCHOOL
BOX 2514
MBEYA-TANZANIA# Types
struct SGD end
struct OJA end
struct CCIPCA end
struct GD end
struct RSGD end
struct SVRG end
struct RSVRG end
struct ALGORITHM971 end
struct HALKO end
struct ORTHITER end
struct RBKITER end
struct SINGLEPASS end
struct SINGLEPASS2 end
struct ARNOLDI end
struct LANCZOS end
struct TENXPCA end

struct ROBBINS_MONRO end
struct MOMENTUM end
struct NAG end
struct ADAGRAD end

# Row / Column
function tenxnm(tenxfile::AbstractString, group::AbstractString)
    N, M = h5open(tenxfile, "r") do file
        read(file[group*"/shape"])
    end
    return N[], M[]
end

# Index Pointer
function indptr(tenxfile::AbstractString, group::AbstractString)
    h5open(tenxfile, "r") do file
        read(file[group*"/indptr"]).+ 1
    end
end

function loadchromium(tenxfile, group, idp, startp, endp, M, perm)
    # new objects
    newidp = ones(Int64, 1)
    newindices = zeros(Int64, 0)
    newdata = zeros(Int64, 0)
    file = h5open(tenxfile, "r")
    # Each column
    l = length(idp) - 1
    grp = file[group]
    progress = Progress(l)
    for i=1:l
        lo = idp[i]
        hi = idp[i+1]
        # Extract
        extindices = grp["indices"][lo:hi-1].+ 1
        extdata = grp["data"][lo:hi-1]
        orderIndices = sortperm(extindices)
        extindices = extindices[orderIndices]
        extdata = extdata[orderIndices]
        # e.g. 325
        lower = searchsortedfirst(extindices, startp)
        # e.g. 663
        upper = searchsortedlast(extindices, endp)
        # update
        append!(newindices, extindices[lower:upper])
        append!(newdata, extdata[lower:upper])
        append!(newidp, length(newdata)+1)
        # Progress Bar
        next!(progress)
    end
    close(file)
    @assert minimum(newindices) >= startp
    @assert maximum(newindices) <= endp
    newindices = newindices.- (startp - 1)
    if perm
    counts = SparseMatrixCSC(endp - startp + 1, M, newidp, newindices, newdata[randperm(length(newdata))])
    else
    counts = SparseMatrixCSC(endp - startp + 1, M, newidp, newindices, newdata)
    end
    SparseArrays.sortSparseMatrixCSC!(counts)
    return counts
end

function sparseLog10(X::SparseMatrixCSC)
    m = X.m
    n = X.n
    colptr = X.colptr
    rowval = X.rowval
    nzval = log10.(X.nzval.+ 1)
    return SparseMatrixCSC(m, n, colptr, rowval, nzval)
end

# Check NaN value (only GD)
function checkNaN(W::AbstractArray, pca::GD)
    if any(isnan, W)
        error("NaN values are generated. Select other stepsize")
    end
end

# Check NaN value (other PCA)
function checkNaN(N::Number, s::Number, n::Number, W::AbstractArray, evalfreq::Number, pca::Union{OJA,SGD,CCIPCA,RSGD,SVRG,RSVRG})
    if mod((N*(s-1)+n), evalfreq) == 0
        if any(isnan, W)
            error("NaN values are generated. Select other stepsize")
        end
    end
end

# Output the result of PCA
function output(outdir::AbstractString, out::Tuple, expvar::Number)
    writecsv(joinpath(outdir, "Eigen_vectors.csv"), out[1])
    writecsv(joinpath(outdir, "Eigen_values.csv"), out[2])
    writecsv(joinpath(outdir, "Loadings.csv"), out[3])
    writecsv(joinpath(outdir, "Scores.csv"), out[4])
    writecsv(joinpath(outdir, "ExpVar.csv"), out[5])
    if out[5] > expvar && out[6] == 1
        touch(joinpath(outdir, "Converged"))
    end
end

writecsv(filename::AbstractString, data) = writedlm(filename, data, ',')
readcsv(filename::AbstractString) = readdlm(filename, ',')
readcsv(filename::AbstractString, ::Type{T}) where {T} = readdlm(filename, ',', T)


# Parse command line options (TENXPCA)
function parse_commandline(pca::TENXPCA)
    s = ArgParseSettings()

    @add_arg_table s begin
        "--tenxfile"
            help = "10XHDF5 file"
            arg_type = AbstractString
            required = true
        "--outdir", "-o"
            help = "The directory specified the directory you want to save the result."
            arg_type = AbstractString
            default = "."
            required = false
        "--scale"
            help = "{sqrt,log,raw}-scaling of the value."
            arg_type = AbstractString
            default = "sqrt"
        "--rowmeanlist", "-m"
            help = "The mean of each row of matrix. The CSV file is generated by `OnlinePCA.sumr` functions."
