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

## Keep some values of vector.

Beginner
185 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.

1 Solution
Black Belt
185 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
```

Black Belt
186 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
```