Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
blkdiag very slow?

Subject: blkdiag very slow?

From: Lam

Date: 31 May, 2013 06:53:08

Message: 1 of 1

Here is a code for creating sparse block diagonal matrix:

n = 100;
C = cell(n);
C(:) = {1};
tic;blkdiag(sparse(0,0),C{:});toc;

What I'm trying to do is to create a block diagonal matrix from cell,
where the number n is very large.

However it seems that this code is very slow (around O(n^3)).
Any suggestion on improvement?

Lam

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us