Extract diagonal from a matrix when extract is set to true.  
More...
Extract diagonal from a matrix when extract is set to true. 
Create a diagonal marix from input array when extract is set to false
- Parameters
- 
  
    | [out] | out | is the array created from the input array in |  | [in] | in | is the input array which is the diagonal |  | [in] | num | is the diagonal index |  
 
 
 
- Parameters
- 
  
    | [out] | out | is the num-th diagonal ofin |  | [in] | in | is the input matrix |  | [in] | num | is the diagonal index |  
 
 
 
      
        
          | AFAPI array af::diag | ( | const array & | in, | 
        
          |  |  | const int | num = 0, | 
        
          |  |  | const bool | extract = true | 
        
          |  | ) |  |  | 
      
 
- Parameters
- 
  
    | [in] | in | is the input array |  | [in] | num | is the diagonal index |  | [in] | extract | when true returns an array containing diagonal of tha matrix and when false returns a matrix with inas diagonal |  
 
- Returns
- an array with either the diagonal or the matrix based on extract
- Examples: 
- svd.cpp.