Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Keep some values of vector.

A___Fiori
Beginner
345 Views

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
1 Solution
mecej4
Honored Contributor III
345 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
mecej4
Honored Contributor III
346 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

 

0 Kudos
Reply