Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
7 Views

Keep some values of vector.

Jump to solution

Hello, I want to keep some elements of a vector without using a for-loop. For example,

x = [ 10 20 30 40 .... 100] and index = [1 5 10];

In MATLAB you use x(1,index). 

Could you please tell me if there is a command with mkl?

Thank you very much.

F.

0 Kudos

Accepted Solutions
Highlighted
Black Belt
7 Views

MKL is a library of routines, and those routines can be called from compiled languages such as C and Fortran. Matlab, Python, etc., are interpreted languages with facilities to call MKL routines. Your question has very little to do with MKL, but relates to the ability of a language to support arrays and vector indices into arrays.

In Fortran, for example, the following program can be written.

program tvec
real :: x(10) = [10,20,30,40,50,60,70,80,90,100]
integer :: ix(3) = [1,5,10]
!
print *,x(ix)
!
end program

 

View solution in original post

0 Kudos
1 Reply
Highlighted
Black Belt
8 Views

MKL is a library of routines, and those routines can be called from compiled languages such as C and Fortran. Matlab, Python, etc., are interpreted languages with facilities to call MKL routines. Your question has very little to do with MKL, but relates to the ability of a language to support arrays and vector indices into arrays.

In Fortran, for example, the following program can be written.

program tvec
real :: x(10) = [10,20,30,40,50,60,70,80,90,100]
integer :: ix(3) = [1,5,10]
!
print *,x(ix)
!
end program

 

View solution in original post

0 Kudos