Have a look at the description in
https://computation.llnl.gov/casc/sundials/documentation/kin_guide/node5.html
On Wed, 2015-05-13 at 23:04, Pileas wrote:
> Hello all,
>
> I'm trying to solve a system of equations using the Sundials package for
> Julia.
>
> The code is the following:
>
> #=
nts.
>
> On Thursday, May 7, 2015 at 7:12:40 AM UTC+2, Mauro wrote:
>>
>> > Any suggestions for solving a nonlinear system of ~1000 coupled ODEs
>> with
>> > complex coefficients?
>>
>> Try your luck with the ODE solvers: ODE.jl, DASSL.jl and Sund
Here is my understanding of Type. Beware though, it might be completely
wrong!!!
`Type` in itself is just an ordinary abstract type:
julia> typeof(Type)
DataType
julia> super(Type)
Any
and DataType is a subtype of it
julia> subtypes(Type)
3-element Array{Any,1}:
DataType
TypeConstru
Have a read through
http://docs.julialang.org/en/release-0.3/manual/performance-tips/
Basically, the fields should have a concrete type if used in performance
critical code. Otherwise, no annotations are fine. Note that there is
not performance gain from annotating with non-concrete types (like
> Any suggestions for solving a nonlinear system of ~1000 coupled ODEs with
> complex coefficients?
Try your luck with the ODE solvers: ODE.jl, DASSL.jl and Sundials.jl.
For sundials you will probably have to split the equations into real and
imaginary part.
>> For instance your first nzval update could be:
>>
>> locs = Vector{Int}[[-1, 18, 63, 103],
>> [1, 63],
>> [1, 18],
>> ...
>> ]
>> function update_nzval!(nzval, v, locs)
>> for i =1:length(locs)
>> nzval[i] = 0
>> for j=2:
On Wed, 2015-05-06 at 18:25, Stéphane Mottelet
wrote:
> As I already answered to Steven, these matrices are not just "data"
> because their elements change at each iteration of an optimization
> process. So i need "code" to update the matrices.
Anything you can achieve with metaprogramming you
Can you provide a self-contained, running test example?
Also, there is no need for the anonymous function here:
tout,yout=ODE.ode4(functionName,t,x)
On Wed, 2015-05-06 at 19:02, Lytu wrote:
> I have issues with :
> tout,yout=ODE.ode4((t,x)->functionName(t,x),t,x)
> it gives the error: BoundsErr
> Yes, this seems like a severe abuse of the compiler. It makes much more
> sense for this to be input as data rather than code.
Nonetheless, 4.7 seconds compilation time for one function seems a lot.
Ok, it is 2000 lines long but pretty simple. What causes this?
> On Wed, May 6, 2015 at 8:42 AM
This looks like JIT compiler performance issue to me. Unless someone
else more knowledgeable comments you should consider filing an issue.
In the meantime, you could try to re-write your code to use loops
instead of explicitly unrolling everything. That might increase overall
performance even tho
> Yeah thanks, figured there was a simple solution, is this being
> affected by the big tuple/vararg overhaul?
You're welcome, and no, I don't think it should be affected.
> On 2 May 2015 at 14:37, Mauro wrote:
>> Splat the fields?
>>
>> function mutateimmut
You need to be on 0.4 to do this.
On Sat, 2015-05-02 at 20:40, Krishna Subramanian wrote:
> I would like to know how to do something like this-
> typealias Corpus Array{Int,1}
>
> and write a constructor for it. Currently, if I do -
>
> Corpus() = Array(Int,0)
>
> I get-
>
> ERROR: cannot define
ields=getargs(c)
>mutate!(fields)
>if length(fields)==1
> return typeof(c)(fields[1])
>elseif length(fields)==2
> return typeof(c)(fields[1],fields[2])
>#etc...
>end
> end
>
> On 2 May 2015 at 12:43, Mauro wrote:
>> Maybe some pseudo code wou
Maybe some pseudo code would make understanding your problem easier?
On Sat, 2015-05-02 at 10:34, Marcus Appelros wrote:
> This is the use case: abstract Component with a getargs(c::Component) that
> returns an array with the fields of components, for concreteness lets say a
> Der type with the
On Thu, 2015-04-30 at 18:37, Tom Breloff wrote:
> I actually wonder if the bug is that Versions 1 and 4 *should* produce an
> error, but they secretly work. In your version 1:
>
> for i=1:2
> if i>=2; println(z); end
> z="Hi"
> end
>
> z should be local to each iteration of the loop,
>> Can anyone point me in the right direction of the files/functions in the
>> core library where dispatch is handled? I'd like to explore a little so I
>> can make comments that account for the relative ease at implementing some
>> of the changes suggested.
>>
>
> Start here:
> https://github.com
This works:
julia> Tuple{Int,Int}[(z, 2z) for z in 1:3]
3-element Array{Tuple{Int64,Int64},1}:
(1,2)
(2,4)
(3,6)
because now the type of (2,3) is Tuple{Int,Int} and not (Int,Int) (which
is just a tuple of datatypes).
On Thu, 2015-04-30 at 11:53, Jim Garrison wrote:
> In Julia 0.3, I can crea
That issue https://github.com/JuliaLang/julia/issues/1090 is still open,
thus the feature does not exist yet. A bit further along is it with
anonymous functions https://github.com/JuliaLang/julia/pull/10269. The
problem is that with multi-functions it is not that clear how to
implement return typ
Have a look at https://github.com/JuliaLang/julia/issues/10559 and
linked issues. But I do think that your Version 3 is a bug. So unless
someone comes up with a reason+explanation you should file a report.
On Wed, 2015-04-29 at 17:20, Sisyphuss wrote:
> Please these four versions:
> Version 1:
In ODE.jl, I would like to be able to take the norm of a Vector
containing other things than just numbers:
type Point
x::Float64
y::Float64
end
Base.norm(pt::Point, p=2) = norm([pt.x, pt.y], p)
norm(Point(3,4)) # == 5
norm([Point(3,4), Point(3,1)]) # does not work:
# ERROR: `abs` has no
It is a bit hard to tell what is going wrong with essentially no
information. Does the memory usage of Julia go up more than you would
expect from storing the results? Any difference between 0.3 and 0.4?
Anyway, you should try and make a small self-contained runable example
and post it otherwise
> Thank you! For this question, invoke indeed a good solution :)
>
> How about a more general case. For example, I already have a function foo
> foo(X::Int)=X+1
> in the environment.
>
> Then I want to overload foo to forbid negative input:
> function foo(X::Int)
> @assert(X>=0,"X should be a p
I don't think it is realistic to expect be able to willy-nilly be
'using' any number of packages and it just works. The way you propose
may work most of the time, however, there were some solid arguments made
in this thread on how that can lead to hard to catch failures.
And maybe more importantl
ts
> a keyword for what to write in place of Array.
>
> On 25/04/2015, Mauro wrote:
>> On Sat, 2015-04-25 at 19:55, Marcus Appelros
>> wrote:
>>> Feels somehow sufficient to direct all functions to the data field. We can
>>>
>>> have a macro like
>
>> I think this optimisation should work irrespective of what fn! returns
>> by the fact that the value is not used. This and more seems to happen
>> in the first-order function. Here a version of first-order
>> function which calls a function which returns an inferred Any:
>>
>> const aa = A
On Sat, 2015-04-25 at 19:55, Marcus Appelros wrote:
> Feels somehow sufficient to direct all functions to the data field. We can
> have a macro like
>
> @foranyfunction f(c::Cubes,a::AnyArgs)=f(c.data,a)
https://github.com/JuliaLang/julia/pull/3292
> "What you really want to be able to do is de
> I'd love to see interfaces in general, especially for things like
> iteration. If I implement a base interface for my type I'd like to be
> able to assert that it is fully implemented.
Check out Traits.jl (is getting reasonably stable, although I haven't
updated it to post #10380 Julia).
>> 3) inside my own namespace, modules continue to use exports but I have to
>> implement SuperSecretBase modules managing my function collapses. (Or
>> minimize the use of modules)
>>
However, it probably makes sense to define the meaning of your generic
functions somewhere centrally. And this i
> type ParetoPoint
> # Design variables.
> vars::Array{Float64,1}
> # Objective functions.
> f::Array{Float64, 1}
> end
How large are the vectors in vars and f? Are they always the same size?
If so, an immutable-isbits datatype might help.
> I am creating the list (the Pareto fro
There is `first`
On Fri, 2015-04-24 at 12:36, Tim Holy wrote:
> There's endof(), but I don't know of a corresponding one for the beginning.
>
> --Tim
>
> On Friday, April 24, 2015 03:14:26 AM Tomas Lycken wrote:
>> I'm implementing a collection of types that implement indexing, but where
>> the i
> - In the current implementation of Julia and Python/Scipy, you need to give
> all the points t1,...,tn where you want to know y at the very beginning. If
> you want to solve the differential equation on [ta,tb] and you want to find a
> t such that y(t)=0, you are stuck because you'll most like
It's a tricky business: https://en.wikipedia.org/wiki/Clean_room_design ...
On Fri, 2015-04-24 at 10:28, François Fayard wrote:
> I'll make sure I won't use a single line of their code and only use the
> papers they refer to.
>> Well it seems Julia should know that nothing is used from fn!, without
>> knowing anything about fn!. That is at least what @code_warntype
>> suggest (with julia --inline=no). For
>>
>> function f(ar)
>> for i=1:n
>> hh!(ar, i)
>> end
>> end
>>
>> the loop gives:
>>
>>
a few more? All of them?
>>> (3) Line 17 asserts that N is an integer, but sqrt(length(P)) could be
>>> non-integral.
>>> (4) I don't really understand what is going on with countnonzeros, but
>>> maybe a pattern matching syntax ala Match.jl could help
>> >> >> function f(fn!,ar)
>> >> >> for i=1:n
>> >> >> fn!(ar, i) # fn! updates ar[i] somehow, returns nothing
>> >> >> nothing# to make sure output of f is discarded
>> >> >> end
>> >> >> end
>
>
> I'm curious how you would see it optimised? IIUC Julia doesn't kn
I'd like to chime in: it would be great to know soon about acceptance
and such to book travels.
On Thu, 2015-04-23 at 19:35, Carlo di Celico wrote:
> Are we there yet? :D
>
> On Tuesday, February 24, 2015 at 11:50:10 AM UTC-5, Hunter Owens wrote:
>>
>> Yup! We're shooting for roughly ~March 15th,
ument inlining" solve all the higher order
function problems? And is the problem described below, not quite a bit
easier to solve?
> On Thursday, April 23, 2015 at 9:34:48 AM UTC-5, Mauro wrote:
>>
>> Thanks! In that case, I'll file an issue then to get this noted. Also,
>
"up-for-grabs" issue).
>
> On Thu, Apr 23, 2015 at 9:18 AM Mauro wrote:
>
>> It is well know that Julia struggles with type inference in higher order
>> functions. This usually leads to slow code and memory allocations.
>> There are a few hacks to work around
It is well know that Julia struggles with type inference in higher order
functions. This usually leads to slow code and memory allocations.
There are a few hacks to work around this. Anyway, the question I have
is: Why can't Julia do better with in-place functions?
In short, a higher-order funct
da06e/base/linalg/symmetric.jl#L34
>
> Notice that it requires two method definitions for each type.
>
> 2015-04-22 8:57 GMT-04:00 Tim Holy :
>
>> As Jeff says...this is why `similar` exists.
>>
>> --Tim
>>
>> On Wednesday, April 22, 2015 10:03:02 AM Mau
all))(:jl_alloc_array_1d,$(Expr(:call1, :(top(apply_type)),
:Array, Float64, 1)),$(Expr(:call1, :(top(svec)), :Any,
:Int)),Array{Float64,1},0,5,0)::Array{Float64,1}
end::Array{Float64,1}
But is there a way to do this type-stabally in 0.3 too?
On Wed, 2015-04-22 at 10:03, Mauro wrote:
> Thanks J
I think this should work:
typealias Foo Type{Function, Function}
although I don't have a julia build after the merge of #10380 where
tuple types were modified.
On Wed, 2015-04-22 at 08:44, Miao Yang wrote:
> I don't know how to describe my problem, so let me past the code.
>
> ```
>
> julia>
>
> So you can't generically reconstruct some arbitrary subtype by some generic
> rearrangement of its type parameters.
>
> On Tue, Apr 21, 2015 at 4:34 PM Mauro wrote:
>
>> I have a parameterized type and want to get the primary-type. For
>> example, I got
>&
I have a parameterized type and want to get the primary-type. For
example, I got
a = Array{Int,2}
is there a type-stable way to get Array? This is non-type stable:
f(t::Type) = t.name.primary
as the inferred return type is Type.
This does not work:
f{T, S}(::Type{T{S...}}) = T
Any ideas? T
Did you see this:
http://docs.julialang.org/en/latest/manual/running-external-programs/
On Sat, 2015-04-18 at 10:01, Jiyin Yiyong wrote:
> I want to create a command line tool by create a Julia module. But it's not
> mentioned in the docs? Is there a quick solution for that?
If you make the Pair immutable then it should work out of the box.
(Note that Pair is a datatype in 0.4, so probably you should either use
something compatible or something else).
Immutables are compared by the value of their fields, whereas mutables
by ===, i.e. whether they are same object in me
I don't think there is a semi-standard. Here my package:
https://github.com/mauro3/Parameters.jl/blob/master/examples/ex1.jl
On Thu, 2015-04-16 at 12:18, Tamas Papp wrote:
> Hi,
>
> A comment for PR 6122 [1] mentions packages that define keyword
> constructors, which ones are these? Several snip
On Mon, 2015-04-13 at 16:22, Tamas Papp wrote:
> On Mon, Apr 13 2015, Mauro wrote:
>
>> Why can you not make it into a function?
>>
>> function foo!(spec::Symbol, A, i)
>> A[i,spec] = 1
>> end
>> function foo!{T<:Real}(spec::Vector{(Symbol,T), A
>-
>
>-
>
>
> cljs
>
>
>
> Array{Any,1}
> Array{Any,2}
> Any["[0.054008985630280115,0.8947273976690304,0.14961853234717193,0.72895523733,0.8907801902141823]"]
>
> SubString{ASCIIString}
>
> in both cases I woul
Why can you not make it into a function?
function foo!(spec::Symbol, A, i)
A[i,spec] = 1
end
function foo!{T<:Real}(spec::Vector{(Symbol,T), A, i)
@assert(isapprox(sum(map(x -> x[2],spec)),1))
for (obs,prob) = spec
A[i,obs] = prob
end
A[i,spec] = 1
end
foo!(spec,
Hi Andrei,
just a general note, unless someone is actually interested in using your
code, a code review might be too much to ask of people. Thus the lack
in responses. See:
https://groups.google.com/forum/#!searchin/julia-users/karpinski$20reivew/julia-users/C5cVjAuGA8U/HLV5rAjIuLMJ
The way to
An example which can be copy-pasted would be helpful. M
On Sun, 2015-04-12 at 16:47, JKpie wrote:
> Hi,
>
> I am new Julia coder (I started to learn Julia two weeks ago). I have a
> problem with writedlm and readdlm functions.
> I have an array of vectors:
>
> Vector Array{Float32,N},4
>
> When
On Thu, 2015-04-09 at 17:57, Benjamin Piwowarski wrote:
> Le mardi 10 mars 2015 17:56:40 UTC+1, Mauro a écrit :
>>
>> >> Have a look at stagedfunction (v0.4).
>> >>
>> > I tried with the nightly build, but without success (using
>> stagedfunctio
> Mauro, thanks for the link. I read the paper by Logg and it seems
> interesting. Do you have any references for how the mapping from the cells
> to the actual finite elements is done?
No, I never got that far. But it doesn't contain any nodes, so
presumably those are all sep
> Can you comment on the performance implications of directly accessing
> fields vs your approach? I'm guessing that directly accessing the fields
> would be faster?
I think usually it should get inlined and there is no difference:
julia> immutable A
a::Int
end
julia> function f
Nat and I once started on a mesh library which implements some of that:
https://bitbucket.org/maurow/mesh.jl
but it has gone a bit stale.
In the spirit of Tim's response, it defines a big mesh datatype and then
helper dataytpes, for instance Vertices, which are just a thin wrapper
around the mesh.
On Wed, 2015-04-08 at 15:34, Daan Huybrechs wrote:
> I was a little surprised today by the following behaviour:
>
> julia> f(d=2) = d
> f (generic function with 2 methods)
>
> julia> f(a::Int) = -a
> f (generic function with 3 methods)
>
> julia> f()
> -2
>
> julia> methods(f)
> # 3 methods for g
> If we require a 'catch' block for every "try", it would be cleaner.
> Otherwise I suggest we had a note in the documentation to state the
> caveats. Particularly for those who come from other background and get too
> excited about "try end" terse syntax. I would be happy to make some edits
>
In 0.3 it's not possible in 0.4 this works:
julia> type A{T,P}
a::T
end
julia> typealias B{T} A{T, 1}
A{T,1}
julia> call{T}(::Type{B}, a::T) = B{T}(a)
call (generic function with 936 methods)
julia> B(1.0)
A{Float64,1}(1.0)
See https://github.com/JuliaLang/julia/pull/8712 for
for your swift replies, this was my first
> julia experience and it's great to have such a supportive community.
>
> On Tuesday, April 7, 2015 at 11:40:49 AM UTC-4, Mauro wrote:
>>
>> Make Result an immutable:
>>
>> immutable Result
>> pvalue::Float6
os to [-10,10]
> b = 10
> for k=1:M
> ratios[k] = b*(2/(1+exp(-log2(counts[k,i]/counts[k,j])/(b/2)))-1)
> end
>
> compute!(S,ratios,tot_i,i,j,h_cols,c_cols,M)
> end
> @show (tot_i,tot,tot_i/tot)
> end
>
> end
>
> S = m
On Tue, 2015-04-07 at 06:14, Adam Labadorf wrote:
> Thanks for the replies. I took your suggestions (and reread the scope
> section of the docs) and am still experiencing the gc creep. Below is the
> complete program, with the notable changes that I wrapped the main
> computation in a function
I don't know whether that is mentioned in those issues but one trick is
to have a function fabricating the expression and call that in the
macro:
mymacro_fn(args...) = ...
macro mymacro(args...)
mymacro_fn(args...)
end
If something goes wrong debug it with calling the function directly
which
Types in Julia are invariant:
If T1<:T2 is true
then A1{T1}<:A1{T2} is false (unless T1==T2).
Now setting T1=Float64 and T2=Union( Int64, Float64) means
Vector{Float64}<:Vector{Union( Int64, Float64)} is false. Thus the no
method error.
On Thu, 2015-04-02 at 21:32, Michael Francis wrote:
> Is
> *julia> foo(;kwargs...) = return kwargs*
> *foo (generic function with 1 method)*
>
> *julia> foo(x=1,y=2)*
> *2-element Array{Any,1}:*
> * (:x,1)*
> * (:y,2)*
>
> *julia> d = { :a=> 97, :b => 95 }*
> *Dict{Any,Any} with 2 entries:*
> * :b => 95*
> * :a => 97*
>
> *julia> foo(d...)*
> *ERROR: `
Thanks for the summary! I think something like this should go into the
manual as it is not particularly clear...
On Mon, 2015-03-30 at 17:09, kevin.dale.sm...@gmail.com wrote:
> I think I've got my head pretty much wrapped around all of this. I figured
> I'd recap just in case anyone else comes
function with the same name as a function exported from one of the modules
>> it calls using on? This would most likely indicate a mistake, or an
>> uncoordinated change in the reverse dependency.
>>
>>
>> Regards
>>
>> On Mar 28, 2015, at 10:16 PM, kevin.da..
> That should be index(mydf). I did get the small test case working, but I
> still can't seem to use the same techniques to get my application working.
> I just don't understand how these method overrides are supposed to work.
> I originally thought that you just needed to have methods with t
On Fri, 2015-03-27 at 19:46, kevin.dale.sm...@gmail.com wrote:
> Ok, I narrowed it down to a very small test case. The mymodule.jl file is
> at the bottom of this posting. If you save that to a file then run this
> code, you'll get the same effect as my original problem except with the
> 'ind
> In ApproxFun, a user supplied function is approximated. the
> approximation depends on whether the function is univariate or
> bivariate
How does it work, if the user defines several methods?
f(x) = x
f(x,y) = x+y
>> The method_exists function would probably be a slightly cleaner way
>> to do
> 1. Just define multiple composite types with different move() methods
> (pro), listing the same fields and constructor for each (con).
The type-def could be done with a macro.
> 2. Define a single "state" type that has the necessary fields and
> constructor (pro), include a "state" as a field
this. Hopefully this will be
>> resolved soon!
>>
>
> Mauro: When you say "Hopefully this will be resolved soon! " does that mean
> this is an issue with a planned future fix?
I've had a look through the issues and not one fitted exactly, there are
several rel
> @Mauro Base.$f does not work either.
Yes, that is odd:
julia> a = :cos
:cos
julia> eval(:(Base.$a))
cos (generic function with 13 methods)
julia> eval(:(Base.$a(x::String) = 5))
ERROR: unsupported or misplaced expression $
I think this might be a bug. Anyway, either construct
> I was trying to add a bunch of common functions to DistributedArrays.jl with
> the below code block
>
> for f in [:sum, :minimum, :maximum, :mean]
> @eval begin
> import Base: ($f)
> export ($f)
> function ($f)(D::DArray)
> refs = [@spawnat p ($f)(localpar
This is a known limitation of Julia. The trouble is that Julia cannot
do its type interference with the passed in function. I don't have time
to search for the relevant issues but you should be able to find them.
Similarly, lambdas also suffer from this. Hopefully this will be
resolved soon!
On
> I think his question can be rephrased as "is the module scope in Julia a
> global scope?"
yes
> and "if it is, then do modules share the same global scope, or they
> have there own global scopes?"
each have their own.
>
>
> On Monday, March 23, 2015 at 3:43:08 PM UTC+1, Stefan Karpinski wrot
> Thanks for the reply. So I don't believe I define any global variables in
> the script itself. But I'm thinking this line:
> "*NOTE:* All code in the REPL is evaluated in global scope, so a variable
> defined and assigned at toplevel will be a *global* variable."
>
> might answer my own questio
Are you on 0.4? Then it should be UInt8
On Thu, 2015-03-19 at 21:47, Julia User wrote:
> I did try your suggestion (`ccall("jl_", Void, (Ptr{Uint8},), "Line 305")`
> will probably work.) but got an other Error
>
> libc.jl
> libdl.jl
> env.jl
> error during bootstrap:
> LoadError(at "sysimg.jl"
A quite complicate bootstrap process is running when compiling Julia.
So, there is quite a bit of functionality missing during the bootstrap.
Apparently one of them is STDOUT, thus the error
> UndefVarError(var=:STDOUT)))
Search the list for some tips and tricks on how to debug Julia itself.
Alth
> I'd be interested to know a case where confusion could arise.
I remember that I got confused by a python library using the bit-shift
operator >> for writing to files (C++ style). Got me confused for sure.
I think it makes sense that typing, say, ?map should give you a help
text which applies
> My thinking being that this would help avoid ambiguity with my code, as I
> sometimes work with other units of time (e.g. seconds) that are also
> floating point numbers. Of course, this introduced a number of problems in
> my existing code, including
There is also the Units.jl package, whic
> I do find this unsatisfying, because by the same logic I would expect
> `[i=>i for i in 1:2]` to create an array of pairs in the future. But
> the syntax currently creates a dictionary and does not seem to be
> deprecated. In fact, there seems to be no dict comprehension syntax
> consistent wit
On Mon, 2015-03-16 at 08:40, Christoph Ortner
wrote:
> Lex, Stefan: Would it not be possible to throw an exception when the
> conversion is considered "unsafe"?
That's the current behavior:
julia> [1,2][1.0]
1
julia> [1,2][1.0001]
ERROR: InexactError()
in getindex at array.jl:246
julia> [1
> type LinTrig <: FElement
> v1::Int
> end
Here you should probably use `immutable`, that way it will be stored as
efficiently as ints.
> type LinQuad <: FElement
> v1::Int
> v2::Int
> end
>
>
> type Node
> c::Float64
> end
>
>
> type FEMesh
> node::Vector{Node}
> elements
>> you should be able to write:
>>
>> @inbounds for y in 1:img.height
>> @simd for x in 1:img.wid
>> if 1 < x < img.wid
>> left = img.data[x-1,y]
>> center = img.data[x,y]
>> @inbounds right = img.data[x+1,y]
>>
>> Just curious, why did you get rid of t
1:10 creates a UnitRange which stores just two numbers, start and
stop:
julia> typeof(1:10)
UnitRange{Int64} (constructor with 1 method)
julia> names(UnitRange)
2-element Array{Symbol,1}:
:start
:stop
To actually create the list you'd use collect(1:10)
On Thu, 2015-03-12 at 14:19, Ali Rezaee
> Hi
> Mauro - thanks for that as that makes it clear whats happening under the
> bonnet. So, what if you then wanted to sum...
> 1.4827
> 1.48069
> 0.884897
> 1.22739
> is that possible or am I being a bit dumb here.
Just add another sum(ans) after below t
> However, I supposed this other way should work too, but it didn't:
> names = Array{String};
> push!(names,"word2");
>
> It gives me the following error: "ERROR: `push!` has no method matching
> push!(::Type{Array{String,N}}, ::ASCIIString)"
>
> Why is String[] and Array(String,0) different from A
64,1}:
1.4827
1.48069
0.884897
1.22739
So 1.4827 = ans[1][1]+ans[2][1]+ans[3][1]
> On Thursday, 12 March 2015 09:50:19 UTC, Mauro wrote:
>>
>> > const x = rand(8)
>> > [ x[i-4:i-1] for i = 6] .. this gives me a 4 element array.
>>
>> This seems a bit
> const x = rand(8)
> [ x[i-4:i-1] for i = 6] .. this gives me a 4 element array.
This seems a bit odd, what are you trying to achieve here? Anyway it
produces a Array{Array{Float64,1},1}, i.e. an array of arrays containing
one array.
> I now want to sum the ouput - this is what I tried ...
> su
Julia is not yet very good with producing fast vectorized code which
does not allocate temporaries. The temporaries is what gets you here.
However, running your example, I get a slightly different a different
*.mem file (which makes more sense to me):
- function forward_propagate(nl::Neu
namic scope, which is (I think) a
different issue to soft and hard scope.
I'll move some of this discussion to
https://github.com/JuliaLang/julia/issues/9955
> On Tuesday, March 10, 2015 at 10:40:53 PM UTC+1, Mauro wrote:
>>
>> I think this is the soft vs hard scope issue.
I think this is the soft vs hard scope issue. See:
https://github.com/JuliaLang/julia/issues/9955
That issue could use some fleshing out though...
On Tue, 2015-03-10 at 20:03, Wendell Zheng wrote:
> *Input 1:*
> y = 0
> function foo()
> y = 10
> end
> foo()
> y
>
> *Output 1:*
> 0
>
> *Inpu
Sadly not. Have a look at
https://github.com/JuliaLang/julia/issues/1090
and
https://github.com/JuliaLang/julia/pull/10269
The complication in Julia is that with its multimethods, it is not so
clear what the return type of a generic function actually means.
On Tue, 2015-03-10 at 21:24, Shivkumar
Have a look at the permute! function in julia:
@less permute!([1,2], [1,2])
Modifying it to
function permute!!{T<:Integer}(a, i, p::AbstractVector{T})
count = 0
start = 0
while count < length(a)
ptr = start = findnext(p, start+1)
temp = a[i,start]
next = p[star
ode
>> > instead. Nuisance though.
>> But you shouldn't need to. Julia is able to find out what the return
>> type is as long as you write type-stable code. Can you give more details
>> about what you're trying to achieve?
>>
>>
>> Regards
>> Have a look at stagedfunction (v0.4).
>>
> I tried with the nightly build, but without success (using stagedfunction
> instead of function) - however, it looks like it is the solution, maybe I
> will just have to wait until this is implemented (and the syntax set).
You will need to adapt the
> abstract typeA
>
> immutable typeA1 <: typeA end
> immutable typeA2 <: typeA end
>
> type typeB1 end
> type typeB2 end
More Julian would be to write:
transformType(T::Type{typeA1}) = typeB1
transformType(T::Type{typeA2}) = typeB2
transformType(T::Type) = error("Cannot handle type $T")
> functi
It would be helpful if you could post an example which runs with just
copy-paste into the REPL.
On Tue, 2015-03-10 at 10:55, Kacem HARIZ wrote:
> I got stuck by an error in Julia! please I need help!
>
> *here is the code:*
>
>
> *w=1;*
> *γ=0.01;*
> *f(x,y)= [y;-w^2*sin(x)-u*w^2*cos(x) -2γ*y];
On my system I need to qualify it with Base, so Base.axpy! works.
On Mon, 2015-03-09 at 11:20, Daniel Carrera wrote:
> Hello,
>
> The Julia documentation says that you can access some BLAS functions:
>
> http://docs.julialang.org/en/release-0.3/stdlib/linalg/?module-Base.LinAlg.BLAS#module-Base.L
401 - 500 of 724 matches
Mail list logo