Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the fastest way of filling a matrix with identical column vectors in IDL?

0
Posted

What is the fastest way of filling a matrix with identical column vectors in IDL?

0

Specifically, if A is a float matrix (m x n) and V is a vector with m elements, is there a faster way than … (loop operation) FOR i=0,n-1 DO A[*,i]=V David Fanning provided the following: (matrix operation) vector = Replicate(1, n) array = V ## vector Stein Vidar contributed the following addition: (rebin operation) array = rebin(reform(v,m,1,/overwrite),m,n,/sample) Timing results from Stein Vidar’s UNIX system: { alpha OSF unix 5.2 Oct 30 1998} Time for Loop: 0.27343702 Time for Matrix: 0.093750000 Time for Rebin: 0.067382932 Timing results from David Fanning’s Windows NT system: { x86 Win32 Windows 5.2 Oct 30 1998} Time for Loop: 0.10000002 Time for Matrix: 0.019999981 Time for Rebin: 0.039999962 Stein mentions, “Note that the relative speeds can vary quite a lot on different architectures.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123