// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/dimreduction.c
// Function: dimension_reduction_isomap
Instanceptr dimension_reduction_isomap(Datasetptr d, Instanceptr traindata, void* parameters, Datasetptr* new_dataset, char* new_dataset_name)
{
 /*!Last Changed 18.01.2008*/
 int howmany;
 matrix eigenvectors, distancematrix, b;
 double *eigenvalues;
 Isomap_parameterptr pisomap = (Isomap_parameterptr) parameters;
 Instanceptr newlist;
 switch (pisomap->neighborhood_type)
  {
   case NEIGHBORHOOD_TYPE_EPSILON:distancematrix = distance_matrix_with_threshold(traindata, pisomap->epsilon);
                                  break;
   case       NEIGHBORHOOD_TYPE_K:distancematrix = distance_matrix_with_k(traindata, pisomap->k);
                                  break;
  } 
 floyds_all_pairs_shortest_path_algorithm(&distancematrix);
 if (!graph_connected(distancematrix))
  {
   printf(m1393);
   matrix_free(distancematrix);
   return NULL;
  }
 b = multi_dimensional_scaling(distancematrix);
 matrix_free(distancematrix);
 switch (pisomap->ppca.reduction_type)
  {
   case REDUCTION_TYPE_FEATURE :eigenvalues = find_eigenvalues_eigenvectors_symmetric(&eigenvectors, b);
                                howmany = pisomap->ppca.featurecount;
                                break;
   case REDUCTION_TYPE_VARIANCE:eigenvalues = find_eigenvalues_eigenvectors(&eigenvectors, b, &howmany, pisomap->ppca.variance_explained);
                                break;
  }
 matrix_free(b);
 newlist = reduce_dimension_of_instancelist_mds(traindata, howmany, eigenvectors, eigenvalues);
 *new_dataset = dimension_reduced_dataset(d, howmany + 1, newlist, new_dataset_name);
 return newlist;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %rbp
movl 0x24(%rdx), %eax
cmpl $0x1, %eax
je 0x1c44e
testl %eax, %eax
jne 0x1c464
movsd 0x18(%r13), %xmm0
movq %r12, %rdi
callq 0xfe88
jmp 0x1c45a
movl 0x20(%r13), %esi
movq %r12, %rdi
callq 0xff47
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1933a
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x191fc
testl %eax, %eax
je 0x1c4d9
movq %rbp, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x1cfbb
movq %rax, %rbp
movq %rdx, %rbx
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3929f
movl 0x10(%r13), %eax
cmpl $0x1, %eax
je 0x1c4f8
testl %eax, %eax
jne 0x1c516
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x3c5c1
movq %rax, %r14
movl (%r13), %eax
movl %eax, 0x4(%rsp)
jmp 0x1c516
leaq 0x7b4b4(%rip), %rdi     # 0x97994
callq 0x4090
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3929f
xorl %ebx, %ebx
jmp 0x1c55b
movsd 0x8(%r13), %xmm0
leaq 0x28(%rsp), %rdi
leaq 0x4(%rsp), %rcx
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x3c5f6
movq %rax, %r14
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3929f
movl 0x4(%rsp), %esi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq %r12, %rdi
movq %r14, %r8
callq 0x1ce4f
movq %rax, %rbx
movl 0x4(%rsp), %esi
incl %esi
movq 0x18(%rsp), %rdi
movq %rax, %rdx
movq %r15, %rcx
callq 0x1414c
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq