Overuse of Deprecated? & other minor complaints

I can accept it is bound to happen a bit up until v1.0, (and possibly a bit after…?), especially still being on v0.4.3 at home, but some uses seem a bit excessive, ie

Deprecated for(…) syntax, use for … instead
Deprecated [1:x], use collect(1:x)

while others are a bit confusing, eg

Deprecated min(x, y), use .min(x,y) instead (or something to that effect)

They all have their reasons. For the ones you show the new syntax isn’t really longer. (the second one is longer though [1:x;] should work).

Ah, i just read the current release is v0.5.2, these are coming from 0.6.98, so perhaps that has something to do with it…

There’s also a few probable bugs i’ve found that i thought might make a half-good carrot to dangle =) I should probably be nice and just tell though :stuck_out_tongue_closed_eyes:

problem with .^
inconsistency with x[1, :] row vectors

Yes. Most packages have not updated to use the un-released version of Julia.

Details?

datax = [data[xvec,:]; cents[countc,:]']; #transpose required here for some reason?

function loopest(ispec) ## Errs?
lest1 = ispec[3] .^ [1:ispec[5]-1];
l2 = sum(lest1) + 1;
l3 = ispec[1] * l2;
print(“\nLoopest $(l3)”);
return(l3);
end;

function xloopest(ispec)
k = 1;
for(iter = 1:ispec[5]-1)
k += ispec[3] ^ iter;
print(“\nk (k)"); end; l3 = ispec[1] * k; print("\nLoopest (l3)”);
return(l3);
end;

Second one is probably the uintrange thing

Why are you putting that second one in an array? A UnitRange already acts as an array, so lest1 = ispec[3] .^ 1:(ispec[5]-1) is what you want?

No?

julia> A = rand(10,10)
10×10 Array{Float64,2}:
 0.91788    0.381739   0.553893   …  0.636338   0.0895755  0.0511415
 0.923617   0.904216   0.514022      0.0115855  0.937157   0.10372
 0.598547   0.0147912  0.763837      0.8237     0.881449   0.898905
 0.0716623  0.775373   0.978852      0.222177   0.0487178  0.582407
 0.27359    0.869289   0.8133        0.477661   0.979182   0.61087
 0.787799   0.403802   0.821295   …  0.78357    0.931848   0.634145
 0.518386   0.81494    0.691428      0.928934   0.547662   0.979005
 0.906648   0.259021   0.129074      0.417072   0.367476   0.377583
 0.413671   0.0479211  0.106108      0.534086   0.616797   0.484255
 0.155153   0.82183    0.0888031     0.357347   0.0915388  0.0615146

julia> B = rand(10,10)
10×10 Array{Float64,2}:
 0.643457   0.235792  0.69109   0.0825125  …  0.199895   0.958693   0.849335
 0.751042   0.45895   0.408544  0.674955      0.810388   0.640998   0.845948
 0.749009   0.827813  0.551657  0.943887      0.927011   0.832004   0.735599
 0.689721   0.833688  0.089932  0.566173      0.729048   0.330048   0.253535
 0.0255838  0.348061  0.401415  0.845217      0.982634   0.332575   0.89266
 0.326644   0.665875  0.246223  0.846489   …  0.0763848  0.851956   0.708185
 0.963863   0.878172  0.476682  0.230957      0.173688   0.690945   0.340588
 0.925577   0.809223  0.198906  0.734026      0.792671   0.0290039  0.61462
 0.159416   0.837881  0.565557  0.625168      0.0547231  0.610614   0.254409
 0.606166   0.77376   0.562231  0.0952985     0.0330701  0.390133   0.48521

julia> [A[1,:];B[1,:]]
20-element Array{Float64,1}:
 0.91788
 0.381739
 0.553893
 0.0362226
 0.472825
 0.682372
 0.362467
 0.636338
 0.0895755
 0.0511415
 0.643457
 0.235792
 0.69109
 0.0825125
 0.0023247
 0.0595701
 0.243804
 0.199895
 0.958693
 0.849335

julia> [A[1,:];B[1,:]]
20-element Array{Float64,1}:
 0.91788
 0.381739
 0.553893
 0.0362226
 0.472825
 0.682372
 0.362467
 0.636338
 0.0895755
 0.0511415
 0.643457
 0.235792
 0.69109
 0.0825125
 0.0023247
 0.0595701
 0.243804
 0.199895
 0.958693
 0.849335

Please post some examples of where you’re having trouble. It’ll be easier to help you. Examples are something that can be ran.

Ah it wasn’t perfectly clear, but xvec is a logical vector / non-scalar
You can see that it does reshape a row vector to column, hence the 20x1 output instead of 10x2, which clashes in the example i gave - reshaping one (the vector) and not the other (generally a matrix)

both loopest and xloopest were expected to give the same results

julia> A = rand(10,10)
10×10 Array{Float64,2}:
 0.642217   0.0619826  0.728376  …  0.53954    0.791777   0.80603
 0.0460328  0.158098   0.383776     0.22269    0.268986   0.539604
 0.276851   0.980149   0.416562     0.455608   0.54859    0.837473
 0.528131   0.0608396  0.319503     0.995711   0.0941816  0.082038
 0.597294   0.601503   0.900173     0.749714   0.774186   0.948177
 0.903385   0.646644   0.615043  …  0.169322   0.159051   0.378032
 0.164304   0.0962996  0.993098     0.81683    0.198354   0.319352
 0.0871752  0.951829   0.600181     0.0760895  0.655165   0.0298956
 0.377345   0.694989   0.875393     0.0883299  0.468306   0.483227
 0.691914   0.732316   0.879031     0.125932   0.321445   0.454192

julia> B = rand(10,10)
10×10 Array{Float64,2}:
 0.621255   0.846065  0.394466  0.251896   …  0.511331  0.696065  0.534228
 0.279284   0.600442  0.908453  0.0615564     0.911261  0.879275  0.97229
 0.843781   0.994801  0.495884  0.50768       0.132034  0.329966  0.845142
 0.146387   0.97065   0.478204  0.660121      0.538725  0.412859  0.706906
 0.572393   0.781777  0.176118  0.456193      0.755145  0.600209  0.903926
 0.0136114  0.610929  0.837651  0.486927   …  0.338707  0.29657   0.179064
 0.434505   0.802624  0.07047   0.579943      0.832152  0.352105  0.0405817
 0.622044   0.113033  0.676789  0.279958      0.997452  0.982933  0.505195
 0.0832082  0.171459  0.710189  0.790077      0.393806  0.37067   0.371154
 0.723232   0.398119  0.27767   0.371918      0.241921  0.289091  0.871812

julia> [A[1,:] B[1,:]]
10×2 Array{Float64,2}:
 0.642217   0.621255
 0.0619826  0.846065
 0.728376   0.394466
 0.788012   0.251896
 0.735827   0.736263
 0.240397   0.758429
 0.67434    0.375701
 0.53954    0.511331
 0.791777   0.696065
 0.80603    0.534228

? Please help me help you. Is this what you’re looking for? You’re talking in tongue instead of posting examples of what’s wrong.

function loopest(ispec)
  lest1 = ispec[3] .^ (1:ispec[5]-1)
  l2 = sum(lest1) + 1
  l3 = ispec[1] * l2;
  print("\nLoopest $(l3)");
  l3
end

function xloopest(ispec)
  k = 1
  for iter = 1:ispec[5]-1
    k += ispec[3] ^ iter;
    print("\nk $(k)");
  end
  l3 = ispec[1] * k;
  print("\nLoopest $(l3)");
  l3
end

ispec = rand(5)
loopest(ispec)
xloopest(ispec)

give the same results

1 Like

There’s no [example] tag though? :disappointed_relieved:

Discourse is markdown-formatted, i.e. the [example] tag is being done by enclosing the code block with 3 backticks (top one optionally followed by julia. Or by indenting the code block by 4 spaces).

Example with your ‘julia-0.4.3 image code’:

```julia
a = rand(10,10)
b = rand(10,10)
[a[1,:]’ ; b[randperm(10) .%2 .== 0, :]] # modified for v0.6
```

The preview (make sure it is not hidden!) and the ‘real view’ show:

a = rand(10,10)
b = rand(10,10)
[a[1,:]' ; b[randperm(10) .%2 .== 0, :]]   # modified for v0.6
2 Likes