julia> a = zeros(5)
5-element Array{Float64,1}:
0.0
0.0
0.0
0.0
0.0
julia> a[1:3][1:2] = 1.0
1.0
julia> a
5-element Array{Float64,1}:
0.0
0.0
0.0
0.0
0.0
I understand that `a[1:3]` creates an extra array and then `a[1:3][1:2] =
1.0` modified the extra array rather than the origin `a`
I find that some mono fonts doesn't display distinguishable greek letters
in unicode.
Any suggested mono font for julia with unicode?
julia> abstract Human
julia> immutable Man <: Human
x::ASCIIString
end
julia>
julia> john = Man("John")
Man("John")
julia> function yo(h::Human)
println("yo ", h.x)
end
yo (generic function with 1 method)
julia> yo(john)
yo John
julia> function yo{T <: Human}(h
equires a hash table lookup at
> run time, and likely some memory allocation.
>
> -erik
>
>
> On Fri, Jun 10, 2016 at 9:40 PM, Po Choi > wrote:
>
>> Ops! I accidentally hit the post button! So the post is not completed!
>>
>> It is an example:
>>
still trying to understand how the multiple-dispatch works. Sometimes
I am confused!
On Friday, June 10, 2016 at 6:37:31 PM UTC-7, Po Choi wrote:
>
>
>
> foo(::Val{1}) = 1
> foo(::Val{2}) = 2
> foo(::Val{2}) = 3
>
> function bar()
>
> for t in Datatype[Val{k} for k in 1:3]
>
> end
> end
>
>
>
>
>
>
>
>
>
>
>
foo(::Val{1}) = 1
foo(::Val{2}) = 2
foo(::Val{2}) = 3
function bar()
for t in Datatype[Val{k} for k in 1:3]
end
end
julia> a = zeros(3)
3-element Array{Float64,1}:
0.0
0.0
0.0
julia> a[2+1]
0.0
julia> a[2 + 1]
0.0
julia> a[2+ 1]
0.0
julia> a[2 +1]
ERROR: MethodError: `typed_hcat` has no method matching
typed_hcat(::Array{Float64,1}, ::Int64, ::Int64)
Closest candidates are:
typed_hcat(::Type{T}, ::Nu
Thanks. I need to pass a set of orthogonal functions and coefficients into
my routines. So I want to know the best practice in Julia to do this.
On Wednesday, April 20, 2016 at 12:51:47 AM UTC-7, David P. Sanders wrote:
>
> If this is your actual use case, then I suggest checking out the
> Polyn
t; On Tue, Apr 19, 2016 at 11:31 PM, Po Choi > wrote:
> > Given coefficients, say, coeff = [1,2,3]
> > I want to get a function for the polynomial: f(x) = coeff[1] * x +
> coeff[1]
> > * x^2 + coeff[1] * x^3
> >
> > First way
> > create_function(c
Given coefficients, say, coeff = [1,2,3]
I want to get a function for the polynomial: f(x) = coeff[1] * x + coeff[1]
* x^2 + coeff[1] * x^3
First way
create_function(coeff) = x -> sum(coeff .* [x^k for k in 1:length(coeff)])
Second way
immutable Myfunction
coeff::Vector
end
call(f::Myfuncti
K the only way to make a generic function is to
> introduce type parameters (using either Array{T,2} or Matrix{T} should be
> fully equivalent).
>
> Does that help?
> Andy
>
>
> On Thursday, April 7, 2016 at 9:58:50 AM UTC+10, Po Choi wrote:
>>
>>
>> Does
a little bit confused about the `T`. Why can `T` appear inside `AAA`
without being declared?
On Wednesday, April 6, 2016 at 1:44:38 PM UTC-7, Yichao Yu wrote:
>
> On Wed, Apr 6, 2016 at 4:23 PM, Po Choi >
> wrote:
> >
> > hello(A::Matrix) = 1
> > hello(A::Vector{M
hello(A::Matrix) = 1
hello(A::Vector{Matrix}) = 2
A = randn(3,3);
AA = [randn(3,3) for k in 1:4];
hello(A)
hello(AA)
The output has method error.
julia> hello(A)
1
julia> hello(AA)
ERROR: MethodError: `hello` has no method matching
hello(::Array{Array{Float64,2},1})
If I write down the types
Does it support MathJax?
On Saturday, September 19, 2015 at 5:16:36 PM UTC-7, Jonathan Malmaud wrote:
>
> Hi all,
> There's been some chatter about maybe switching to a new, more modern
> forum platform for Julia that could potentially subsume julia-users,
> julia-dev, julia-stats, julia-gpu, an
Can I do something like this?
testMatrix(x::Array{1}) = println("It is 1-dimensional.")
testMatrix(x::Array{2}) = println("It is 2-dimensional.")
The above does not work because Array{1} == Array{1, N}
One solution is
testMatrixAgain{T}(x::Array{T, 1}) = println("It is 1-dimensional.")
testMatrix
Before seriously hiring someone to bring Julia into your school, perhaps
you first can try the commercial service from http://juliacomputing.com/ to
organize some workshops or events to see how the students and other
faculties feel about the potential of Julia.
On Wednesday, February 10, 2016 a
Good point. I tried to use this search box in Juila manual, but get nothing.
In R and Matlab, the search would return the function sd/std.
I think, not only the "words" in Julia documentation is needed to improved,
but also the search engine.
On Friday, February 12, 2016 at 12:52:19 AM UTC-8, Mi
One thing I hate Julia is that it is very hard to google for the functions
I need. I feel like Julia has no documentation.
If I google "R standard deviation", the first link is
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/sd.html
which tells all the things about the standard deviation
18 matches
Mail list logo