by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Huckleberry Febbo
@huckl3b3rry87
and includes its dependencies
BridgingBot
@GitterIRCbot
[slack] <chrisrackauckas> do you want to ]activate NLOptControl?
[slack] <chrisrackauckas> you may want to watch https://youtu.be/QVmU29rCjaA since I know it's been a bit since you've been actively dev'ing.
Huckleberry Febbo
@huckl3b3rry87
OK, thank. It seems a quick restart of atom fixed it
Huckleberry Febbo
@huckl3b3rry87
I will def check out that video thanks Chris
matrixbot
@matrixbot
acxz Yeah thx for that video rec
matrixbot
@matrixbot

acxz okay guys I got something weird here

julia> a = 1
1

julia> A = [1]
1-element Array{Int64,1}:
 1

julia> A2 = [[1, 1] [1, 1]]
2×2 Array{Int64,2}:
 1  1
 1  1

julia> one(a)
1

julia> one(A)
ERROR: MethodError: no method matching one(::Array{Int64,1})
Closest candidates are:
  one(::Type{Missing}) at missing.jl:103
  one(::BitArray{2}) at bitarray.jl:426
  one(::Missing) at missing.jl:100
  ...
Stacktrace:
 [1] top-level scope at REPL[59]:1
 [2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.0/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

julia> one(A2)
2×2 Array{Int64,2}:
 1  0
 0  1

Ultimately I want to perform the following operation: inv(A), but since inv(A) calls one(A) which fails, inv(A) also fails.

acxz Looking at the source code of one it seems that it further calls convert(T, 1) but I can't seem to run that code with a dimensionful type. I believe I misunderstanding types here.
matrixbot
@matrixbot

Daniel Lakeland > <@1awtumleef:matrix.org> okay guys I got something weird here

julia> a = 1
1

julia> A = [1]
1-element Array{Int64,1}:
 1

julia> A2 = [[1, 1] [1, 1]]
2×2 Array{Int64,2}:
 1  1
 1  1

julia> one(a)
1

julia> one(A)
ERROR: MethodError: no method matching one(::Array{Int64,1})
Closest candidates are:
  one(::Type{Missing}) at missing.jl:103
  one(::BitArray{2}) at bitarray.jl:426
  one(::Missing) at missing.jl:100
  ...
Stacktrace:
 [1] top-level scope at REPL[59]:1
 [2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.0/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

julia> one(A2)
2×2 Array{Int64,2}:
 1  0
 0  1

Ultimately I want to perform the following operation: inv(A), but since inv(A) calls one(A) which fails, inv(A) also fails.

Strange, inv works for me on an invertible matrix made like that:

julia> inv([[1, 1] [ 2, 1]])
2×2 Array{Float64,2}:
-1.0 2.0
1.0 -1.0

acxz That works for me as well, but inv([2]) doesn't work
Daniel Lakeland I assume you were expecting [0.5] ?
BridgingBot
@GitterIRCbot
[slack] <kleinschmidt> [2] is a vector, which doesn't have an inverse
matrixbot
@matrixbot
acxz but one([2]) also fails
Daniel Lakeland right, because there's no multiplication defined for vectors
Daniel Lakeland you're thinking of [2] as a 1x1 matrix but it's not, it's a 1 vector
Daniel Lakeland I'm not sure if you can make a 1x1 matrix, and/or how
matrixbot
@matrixbot
Daniel Lakeland ones(Float64,(1,1))
Daniel Lakeland reshape([2.0],(1,1))
Daniel Lakeland julia> inv(reshape([2.0],(1,1))
)
1×1 Array{Float64,2}:
0.5
Huckleberry Febbo
@huckl3b3rry87
seems like VS code is the way to go for this....
Huckleberry Febbo
@huckl3b3rry87
seems soo much faster and less buggy
Huckleberry Febbo
@huckl3b3rry87
maybe it is just like this on linux
matrixbot
@matrixbot
acxz I see, so maybe if I explain my usecase it will help. Essentially I need to take an inverse of a variable NxN matrix A based on user input. And the user can specify an positive natural number, including 1. If I try to use the reshape(... solution. I would have to write it as inv(reshape(A,(N,N)) which is an unnecessary operation for all N but 1.
acxz Ah wait maybe [[2]] works?
acxz julia> inv([[2]]) ERROR: MethodError: no method matching inv(::Array{Array{Int64,1},1})
ah nope ☹️
matrixbot
@matrixbot
Daniel Lakeland the reshape solution is I think extremely cheap, so it's not a big deal to do it... let's see
BridgingBot
@GitterIRCbot
[irc] <Thalheim> I'm poking at initial sparc and sparc64 ports (Linux first, then Solaris), are there any other known efforts in this space?
matrixbot
@matrixbot

Daniel Lakeland julia> @benchmark reshape(foo,(10,10))
BenchmarkTools.Trial:
memory estimate: 96 bytes

allocs estimate: 2

minimum time: 53.212 ns (0.00% GC)
median time: 55.661 ns (0.00% GC)
mean time: 69.874 ns (15.51% GC)

maximum time: 8.241 μs (98.01% GC)

samples: 10000
evals/sample: 986

Daniel Lakeland weird, I have no idea why that's all bold etc... but basically reshape is cheap, just do that
acxz whoa yeah that is cheap, thx for your help!
Huckleberry Febbo
@huckl3b3rry87
great youtube video @ChrisRackauckas thanks!
BridgingBot
@GitterIRCbot
[irc] <dTal> Pluto.jl is quietly brilliant. I'm in awe.
matrixbot
@matrixbot
Daniel Lakeland plus one on that. Pluto.jl is amazingly good. do they have a Patron or something?
Daniel Lakeland patreon ... grr autocorrect
matrixbot
@matrixbot
&Adam Did you prefix the bold lines with ##?
Daniel Lakeland I don't think so, it was just copy pasted from the REPL
&Adam Fu
&Adam * Funky
&Adam Are you using element or a different client?
&Adam (apologies for accidentally pressing enter a
&Adam nd sending "fu" if your client doesn't support edits)
matrixbot
@matrixbot
Daniel Lakeland element. the text was sent on desktop
&Adam For future reference, element uses commonmark for markup, so you can enclose content in a codeblock by putting triple-backticks around it.
matrixbot
@matrixbot

Daniel Lakeland * ```
julia> @benchmark reshape(foo,(10,10))
BenchmarkTools.Trial:
memory estimate: 96 bytes

allocs estimate: 2

minimum time: 53.212 ns (0.00% GC)
median time: 55.661 ns (0.00% GC)
mean time: 69.874 ns (15.51% GC)

maximum time: 8.241 μs (98.01% GC)

samples: 10000
evals/sample: 986
```

Daniel Lakeland thanks!
BridgingBot
@GitterIRCbot
[irc] <dTal> weeee I broke IntervalArithmetic
BridgingBot
@GitterIRCbot
[irc] <erentar> hello
BridgingBot
@GitterIRCbot
[irc] <erentar> even though i import DataFrames, select and other functions contained in it do not get defined for some reason
[irc] <erentar> what do?