// File: /workspace/github_c_makefile_star2_O1/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 0x1e344
testl %eax, %eax
jne 0x1e35a
movsd 0x18(%r13), %xmm0
movq %r12, %rdi
callq 0x10b88
jmp 0x1e350
movl 0x20(%r13), %esi
movq %r12, %rdi
callq 0x10c2e
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1adc2
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x1ac6c
testl %eax, %eax
je 0x1e3cf
movq %rbp, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x1eea5
movq %rax, %rbp
movq %rdx, %rbx
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3dbad
movl 0x10(%r13), %eax
cmpl $0x1, %eax
je 0x1e3ee
testl %eax, %eax
jne 0x1e40c
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x41571
movq %rax, %r14
movl (%r13), %eax
movl %eax, 0x4(%rsp)
jmp 0x1e40c
leaq 0x865fe(%rip), %rdi     # 0xa49d4
callq 0x4090
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3dbad
xorl %ebx, %ebx
jmp 0x1e451
movsd 0x8(%r13), %xmm0
leaq 0x28(%rsp), %rdi
leaq 0x4(%rsp), %rcx
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x415a9
movq %rax, %r14
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3dbad
movl 0x4(%rsp), %esi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq %r12, %rdi
movq %r14, %r8
callq 0x1ed39
movq %rax, %rbx
movl 0x4(%rsp), %esi
incl %esi
movq 0x18(%rsp), %rdi
movq %rax, %rdx
movq %r15, %rcx
callq 0x15357
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