convenience methods blas.jl

59 views
Skip to first unread message

Martin Rupp

unread,
Nov 28, 2012, 10:31:37 AM11/28/12
to juli...@googlegroups.com
Hi,
I was wondering if one could add some convenience methods for nrm2, scal and dot like there are for axpy already, I was thinking of sth like this

function nrm2{T,Ta<:Number}(x::Array{T})
    return nrm2(length(x), x, 1)
end

function scal!{T,Ta<:Number}(alpha::Ta, x::Array{T})
    return scal!(length(x), convert(T, alpha), x, 1)
end

function dot{T}(x::Array{T}, y::Array{T})
    if length(x) != length(y)
        error("Inputs should be of the same length")
    end
    return dot!(length(x), x, 1, y, 1)
end

Andreas Noack Jensen

unread,
Nov 28, 2012, 10:51:18 AM11/28/12
to juli...@googlegroups.com
They are there already in blas.jl. And also in the super convenient forms norm and dot in linalg_dense.jl and matmul.jl




2012/11/28 Martin Rupp <martin...@googlemail.com>

--
 
 
 



--
Med venlig hilsen

Andreas Noack Jensen

Message has been deleted

Jeff Bezanson

unread,
Nov 29, 2012, 4:23:12 AM11/29/12
to juli...@googlegroups.com
matmul.jl has dot() and there is also BLAS.dot in blas.jl.


On Thu, Nov 29, 2012 at 3:51 AM, Martin Rupp <martin...@googlemail.com> wrote:
ok, i found norm in linalg_dense, but no function dot there nor a function which uses dot. in blas.jl, there's only the normal scal! and scal!:
function scal!(n::Integer, DA::$elty, DX::Union(Ptr{$elty},Array{$elty}), incx::Integer)
I'm searching for a functions scal(3.0, myVector), or myVector *= 3.0 and dot(myVecA, myVecB) or myVecA * myVecB which uses BLAS.
--
 
 
 

Reply all
Reply to author
Forward
0 new messages