From: Sadegh on 18 Jan 2010 01:27 Hi, As far as I know, matlab does not support 3d sparse matrices. Does anyone have any code that help me to make a 3d sparse matrix and do normal calculations. I am dealing with a 500*500*1000 matrix representing a 3d structure. This matrix has ~1000 non-zero elements. There is an iteration scheme and this matrix is called at every iteration and updated at the end. I can not use 2d sparse matrix and cell structure method that has been used by others... Thanks,
From: Bruno Luong on 18 Jan 2010 02:53 "Sadegh " <ahmadi.sadegh(a)gmail.com> wrote in message <hj0uvo$49u$1(a)fred.mathworks.com>... > Hi, > > As far as I know, matlab does not support 3d sparse matrices. Does anyone have any code that help me to make a 3d sparse matrix and do normal calculations. I am dealing with a 500*500*1000 matrix representing a 3d structure. This matrix has ~1000 non-zero elements. There is an iteration scheme and this matrix is called at every iteration and updated at the end. > > I can not use 2d sparse matrix and cell structure method that has been used by others... The best Matlab structure for such thing is probably a four-column array where the first three are indexes of the non-zero elements and the last column contain the value of the 3D sparse array. You can decide to sort or not. Use function such as ISMEMBER, ACCUMARRAY, SORTROWS to manipulate such thing, put it in OOP if you like. An example of building almost sparse like matrix is in this FEX submission by Matt http://www.mathworks.com/matlabcentral/fileexchange/26181-robust-sparse-data-types The accessing engine is codded in MEX (mine), but it can be do in Matlab too with certainly a tradeoff on speed. Bruno
From: JAMES on 17 Jan 2010 18:31 If you cant do this then you fail, fail. you need to get a life and a donut, unless youre fat which you probebly are and win which case become a teacher becauseyou FAIL. have a nice day.:-)
From: Matt J on 18 Jan 2010 07:25 "Sadegh " <ahmadi.sadegh(a)gmail.com> wrote in message <hj0uvo$49u$1(a)fred.mathworks.com>... > Hi, > > As far as I know, matlab does not support 3d sparse matrices. Does anyone have any code that help me to make a 3d sparse matrix and do normal calculations. I am dealing with a 500*500*1000 matrix representing a 3d structure. This matrix has ~1000 non-zero elements. There is an iteration scheme and this matrix is called at every iteration and updated at the end. > > I can not use 2d sparse matrix and cell structure method that has been used by others... =============== You should probably describe why you think you cannot use a 2D sparse matrix so that we can assess whether you're overlooking something. It's hard to imagine what benefits there are in a 3D sparse array that can't be derived from a 2D matrix with much less work than creating your own new data type. In particular, there are a lot fewer "normal calculations" that are even defined for a 3D array. There is no normal definition for mtimes(*), mldivide(\), or mpower(^), for example...
|
Pages: 1 Prev: how to joint two figures without calling subplot function? Next: sprintf |