Code Monkey home page Code Monkey logo

Comments (4)

chualynn avatar chualynn commented on August 28, 2024

Thank you for the suggestion! I will look into writing a wrapper to allow scalar inputs.

As for the example that you gave, I think the problem is in the way that you define M. The following code works for me:

M = [0.794612+1.9986im]
R = RiemannMatrix(M)
z = [0.30657351+0.34017115im]
theta(z, RiemannMatrix(M))

from theta.jl.

miromarszal avatar miromarszal commented on August 28, 2024

Yes, that works for me too. I somehow thought I need to preserve the number of dimensions, hence the hcat. Thanks a lot!

from theta.jl.

LordThunder333 avatar LordThunder333 commented on August 28, 2024

This, however, fails if I try to specify a characteristic.
function θ(z, τ) M = [τ] R = RiemannMatrix(M) return theta([z], R, char=[1,1]) end
`
θ(randn(ComplexF64), 1.0im)
MethodError: no method matching +(::Vector{Float64}, ::Float64)
For element-wise addition, use broadcasting with dot syntax: array .+ scalar

Closest candidates are:
+(::Any, ::Any, ::Any, ::Any...)
@ Base operators.jl:578
+(::T, ::T) where T<:Union{Float16, Float32, Float64}
@ Base float.jl:408
+(::Union{MathOptInterface.ScalarAffineFunction{T}, MathOptInterface.ScalarQuadraticFunction{T}}, ::T) where T
@ MathOptInterface ~/.julia/packages/MathOptInterface/NCblk/src/Utilities/functions.jl:1783
...

Stacktrace:
[1] theta(z::Vector{ComplexF64}, R::RiemannMatrix; char::Vector{Int64}, derivs::Vector{Any}, derivs_t::Vector{Any})
@ Theta ~/.julia/packages/Theta/2Upgk/src/eval_theta.jl:42
[2] θ(z::ComplexF64, τ::ComplexF64)
@ Main ./In[51]:5
[3] top-level scope
@ In[55]:1

`

from theta.jl.

LordThunder333 avatar LordThunder333 commented on August 28, 2024

A simple hack that I have found works is: char=[[1],[1]], and replacing additions in line 42 and line 61 (in eval_theta) with the vectorized version as the debugger suggests:
x = real(z) + shift_x; # shift z by characteristic
to
`
x = real(z) .+ shift_x; # shift z by characteristic

And,
s = (2πim)^(nderivs) * sum([
(nderivs > 0 ? prod(transpose(d)(p-w) for d in derivs) : 1) * exp(2πim((0.5*(transpose(p-w)R.X(p-w))[1] + transpose(p-w)x)[1]) - π(transpose(p+w0)R.Y(p+w0))[1]) for p in E]); # compute sum over points in ellipsoid
to
s = (2πim)^(nderivs) * sum([
(nderivs > 0 ? prod(transpose(d)(p-w) for d in derivs) : 1) * exp(2πim((0.5*(transpose(p-w)R.X(p-w))[1] .+ transpose(p-w)x)[1]) - π(transpose(p.+w0)R.Y(p.+w0))[1]) for p in E]); # compute sum over points in ellipsoid
`
However, I am unsure if this is the most efficient way to do this.

from theta.jl.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.