Matlab Tools for Multiple Instruction Single Data (MISD)?

조회 수: 2 (최근 30일)
Juan Pablo Segovia
Juan Pablo Segovia 2017년 5월 8일
댓글: Walter Roberson 2017년 5월 9일
Hello,          I have a problem that has more than one million functions to evaluate, all different, for the same data group. Morphologically this type of problem is called MISD (Multiple Instructions Single Data), each mathematical function can be written as a matlab function, with input and output arguments. What is the most efficient way to solve this type of problems with matlab ?.
  댓글 수: 2
Jan
Jan 2017년 5월 8일
It depends on how the functions are stored. Please give us a small example.
Juan Pablo Segovia
Juan Pablo Segovia 2017년 5월 8일
편집: Walter Roberson 2017년 5월 8일
Jan,     
Thanks for your interest in the problem, for example: the main program declares the global variables,
Name Size Bytes Class Attributes
N1 1x1 8 double global
N6 1x1 8 double global
Px 82251x1 658008 double global
S 4496388x6 215826624 double global
V = test0001;
For higher execution speed all the functions were explicitly generated:
% Funtion test0001
Function vpe = test0001
Global s px n1 n6
Vpe = - ((s (px, 2) -n6 + 1). * (S (px, 2) -n6 + 2) * (s (px, 2) -n6 + 3)) / 6;
Return

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2017년 5월 8일
global variables are the slowest kind of variables. You would be better to parameterize your functions
  댓글 수: 7
Juan Pablo Segovia
Juan Pablo Segovia 2017년 5월 9일
Walter, many thanks to you for the advice, you have some examples of similar code or you can recommend me bibliography related to this subject.
I reiterate my gratitude, sincerely J.P.
Walter Roberson
Walter Roberson 2017년 5월 9일
If you have a vector of symbolic expressions, I would probably be tempted to factor() the length of the vector, reshape() with the last (largest) factor as the first dimension, then use matlabFunction on each column, asking to generate files. The purpose here is to batch enough work together to make it worth while to talk to a worker considering communications overhead.
If the expressions are to be reused multiple times, leave the default matlabFunction optimization on; otherwise, the optimization phase might be more expense than it is worth.
After that you can create workers, AddAttachedFiles, and parfeval() to invoke the functions on the current data.
Note: matlabFunction does not currently do well on vectors of functions where the components might require looping or piecewise(): in current implementations it tries put 'if' statements inside the horzcat or vertcat operator. matlabFunction also currently does not do well on int() with a vector of locations to be integrated.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by