Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support julia is not good #807

Open
guessable opened this issue Nov 20, 2023 · 2 comments
Open

Support julia is not good #807

guessable opened this issue Nov 20, 2023 · 2 comments

Comments

@guessable
Copy link

Hi, thank you for the extension.I like this colorscheme but I don't have enough syntax highlighting on the julia language.
Snipaste_2023-11-20_10-34-04
Can we make it better?

@Binaryify
Copy link
Owner

could you provide some example code

@guessable
Copy link
Author

could you provide some example code

Thanks for your reply.sure,here is some julia code

using LinearAlgebra

mat = Matrix{Float64}
vec = Vector{Float64}

function GramSchmidt(𝔸::mat)::mat
  m, n = size(𝔸)
  𝕌 = 𝔸[:, 1] / norm(𝔸[:, 1])
  @simd for j in 2:n
    vⱼ = 𝔸[:, j]
    @simd for i in 1:j-1
      vⱼ -= (@view 𝔸[:, j])' * (@view 𝕌[:, i]) * (@view 𝕌[:, i])
    end
    𝕌 = cat(𝕌, vⱼ / norm(vⱼ), dims=2)
  end
  return 𝕌
end

function ModifiedGS(𝔸::mat)::mat
  m, n = size(𝔸)
  𝕌 = 𝔸[:, 1] / norm(𝔸[:, 1])
  for j in 2:n
    vⱼ = 𝔸[:, j]
    for i in 1:j-1
      vⱼ -= vⱼ' * (@view 𝕌[:, i]) * (@view 𝕌[:, i])
    end
    𝕌 = cat(𝕌, vⱼ / norm(vⱼ), dims=2)
  end
  return 𝕌
end

n = 1000
up = range(0, 1, n)
down = range(0, 1, n)
A = diagm(1 => up, -1 => down)
A += 2 * I(n + 1)

@timev ModifiedGS(A)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants