« first day (1835 days earlier)      last day (1377 days later) » 

6:26 AM
 
 
2 hours later…
8:22 AM
yeah, I knew about this, but I have never sat down to learn it properly to speed up my code hehe. But indeed I know that most processors can do 8 additions at a time
 
 
1 hour later…
9:47 AM
0
Q: construct block matrix consisting of different powers of basis matrices

ThomasIsCodingAssuming that we have a basis matrix A >> A = [1,2;-1,3] A = 1 2 -1 3 I am wondering if there is an easy command that can construct a block matrix consisting of A, A^2, A^3 ... A^n with any given positive integer n, like B = [A; A^2; A^3; ...; A^n] I can make it with loops but I am lo...

I feel like this could be solved using the new pagemtimes() routine or similar. Can you somehow copy the A matrix n times in the third dimension, and then use some bsxfun(), arrayfun() or implicit broadcasting voodoo to mpower() the third dimension?
 
@Adriaan I tried and failed
to apply mpower in the thir dim
makes sense for bsxfun, as its a broadcasting function, i.e. designed for elemetwise stuff
same with arrayfun, its "apply function to each element in array"
but its a matrix power
 
@AnderBiguri Wouldn't B=cell2mat(arrayfun(@(k){A^k},1:n).') work?
 
ah, here he comes
the master of codeglf
to shame me!
 
Heh. That was not the intention
 
yes! It works fantastically!
 
9:56 AM
@AnderBiguri you dont have to golf the word "codegolf" :P
 
😃 I was joking of course! Very nice call, please do answer the question!
 
Nah, it's too similar to yours
 
Now do it while reusing as many intermediate results as possible (i.e. instead of computing A^6 directly, use A^3*A^3 or something)
 
@flawr cdglf -> cgl ->cg
 
Fell freee to add it / edit it
 
9:57 AM
@LuisMendo not at all, it does the thing similalry, but its muuuuuuch cleaner
 
Also I believe this question can be hammered
let me see
 
I added it, but I suggest you add an answer and I'll edit it out!
 
I think there's some trick involving eigenvalues to get the power of a matrix
possibly something like: perform decomposition, get a diagonal matrix, raise the elements in some power, recompose
 
@AnderBiguri It's perfect there
Magician :-D
 
you are :D
 
10:09 AM
@Dev-iL hehe, I'm playing around with similar ideas:)
 
I was trying to see if there is some builit in regarding krylov spaces
 
Any of you ever use overleaf?
I have a "bug" in that whenever I try to type a hat, ^, or tilde, ~, overleaf automatically inserts anywhere between 1 and 3 new lines. Sometimes it doesn't do this for an hour or so, and then it starts doing that again and restarting Overleaf doesn't get rid of the problem, forcing me to manyally remove the new lines every time.
 
10:19 AM
@Adriaan yes
 
However, when placed on a newline, or more than once directly after one another (^^^ or ~~), it doesn't add new lines. FFS.
 
@Adriaan huh werid
 
@Adriaan does the same thing happen with a different keyboard layout?
 
@flawr No idea; I always use US-international with dead keys.
 
yeah the dead keys thing would have been the first thing I'd try turning on and off
 
10:24 AM
What's bugging me most is that it happens "sometimes". In the sense that when I open my document at the start of the day, everything is fine when doing \iota^m and Fig.~\ref{}, but after some arbitrary amount of time it suddenly starts doing those weird 1 to 3 newlines, except when putting multiple hats/tildes behind one another :(
 
does it happen in all browsers?
 
I only have one, FireFox on Ubuntu 18.04
(I know, it's a shitty bug report from me)
 
10:42 AM
@Adriaan got inv(kron(spdiags(-ones(n,1),-1,n+1,n+1),A)+eye(size(A)*(n+1))) but now I need to find a one-liner compatible way to extract a slice of that matrix
 
11:24 AM
@flawr perhaps the ndSparse submission might be helpful to you
 
11:52 AM
@Dev-iL but that's not a builtin:)
ah but feval(@(X)X(size(A,1)+1:end, 1:size(A,2)), inv(kron(spdiags(-ones(n,1),-1,n+1,n+1),A)+eye(size(A)*(n+1)))) works, very elegant.
 
you are stretching the definition of "very elegant" here
2
 
but this one is: X = (kron(spdiags(-ones(n-1,1),-1,n,n),A)+eye(size(A)*n))\[A; zeros(size(A).*[n-1, 1])]
 
 
3 hours later…
3:14 PM
I would have never thought of using matrix division for this :-)
 
Its not even division, its solving a linear system of equations right?
 
right, and it is not very efficient:)
 
I must say, that is indeed elegant
 
and exotic
 
3:31 PM
now I just need to find a way to rewrite it as a convolution
 
:-D
 
 
3 hours later…
6:28 PM
there's a longer article about the guys but it's in Hungarian...
 

« first day (1835 days earlier)      last day (1377 days later) »