-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmu_method.f90
58 lines (45 loc) · 1.22 KB
/
mu_method.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
!
! File: distance.f90
! Author: peter
!
! Created on May 6, 2020, 12:49 PM
!
module mu_method
use random_init
use print_mat
use matrix_mult
use trans
use distance
use add_matrix
use update_h
use update_w
implicit none
private
public::factoring
interface factoring
procedure factoring
end interface factoring
contains
function factoring(A, rank, max_iter)result(stuff)
! Set all the variables
real, Dimension(:,:), intent(in)::A
integer, intent(in)::rank, max_iter
real, Dimension(size(A,1),rank)::W
real, Dimension(rank, size(A,2))::H
integer :: n, i, j
integer:: stuff
stuff=1
!
W = init_start_w(A,rank)
H = init_start_h(A,rank)
print*,"Begin Minimizing Loop!"
do n = 1, max_iter
print*,"Updates -",n
H = h_update(H, W, A)
W = w_update(W, H, A)
print*,"Error ", error(A, matmul(W,H))**2
end do
stuff = print_matrix(A)
stuff = print_matrix(matmul(W,H))
end function factoring
end module mu_method